There was a question years ago, how to get lat long coordinates using only the adress ( here is the link to the question: How can I find the latitude and longitude from address? )
I understand the accepted answer there, but my problem is, for example, in Germany you have no unique adresses, so if I use only adresses to get lat and long coordinates, I may get wrong lat long coordinates. Like, there is one adress called "Hauptstrasse" which is in Berlin and in Frankfurt. So I will get wrong coordinates.
Is there any way to use Adress AND Zip code to get the right lat long coordinates ?
This code for example only uses adresses:
public GeoPoint getLocationFromAddress(String strAddress){
Geocoder coder = new Geocoder(this);
List<Address> address;
GeoPoint p1 = null;
try {
address = coder.getFromLocationName(strAddress,5);
if (address==null) {
return null;
}
Address location=address.get(0);
location.getLatitude();
location.getLongitude();
p1 = new GeoPoint((double) (location.getLatitude() * 1E6),
(double) (location.getLongitude() * 1E6));
return p1;
}
}