I have some locations from all over the city which I previously collect from the same app, but the case is when I receive this locations from the backend I need only to draw the locations are in my street, (I only need to see the locations that belongs only in my street or located only in my street I'm walking in right now)
Is there anyway to differentiate between the street Im walking in and the other streets round me, by get the street name more accurately or getting something like
streetId`?
I'm calling this method at onLocationChanged
method
private String getStreetName(Location location) {
Geocoder geocoder;
List<Address> addresses;
String strAdd="";
geocoder = new Geocoder(this, Locale.getDefault());
try {
addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
if (!addresses.isEmpty()) {
Address returnedAddress = addresses.get(0);
StringBuilder strReturnedAddress = new StringBuilder("");
int i = 0;
do{
strReturnedAddress.append(returnedAddress.getAddressLine(i)).append(" ");
i++;
}while (i < returnedAddress.getMaxAddressLineIndex());
strAdd = strReturnedAddress.toString();
} else {
Log.e("MyCurrentLoctionAddress", "No Address returned!");
}
} catch (Exception e) {
e.printStackTrace();
}
return strAdd;
}
The problem is this address that I get from geocode is no accurate at all.
I have got these three addresses at the same street within only 100 meter at this street, I got 3 deferent addresses
*Mashyakhet Al Azhar Al Sharif, El-Gamaleya, Monsha'et Nasser, Cairo Governorate, Egypt
*Salah Salem St, Monsha'et Nasser, Cairo Governorate, Egypt
*139 Salah Salem St, El-Gamaleya, El Gamaliya, Cairo Governorate, Egypt