In Google Maps how can we get Latitude and Longitude by passing the Address?
and what is开发者_运维百科 the Address format need to be mentioned?
To find latitude and longitude from address string .....
Make object of
Geocoder
Call
getFromLocationName()
pass the address (place name) string as argument also maximum number of results you want for that place name
Here is demo ...
Geocoder coder = new Geocoder(LocationMap.this);
List<Address> geocodeResults = coder.getFromLocationName(placeName, 10);
Iterator<Address> locations = geocodeResults.iterator();
while (locations.hasNext()) {
Address loc = locations.next();
_lattitude_ = loc.getLatitude() ;
_longidude_ = loc.getLongitude();
}
And there are no specific address format required.
For example you can try any city name, country name, hotel name, area name, road name, well known place name ( Try "Eiffel tower") ... anything (from many things).
Found this older post. Should solve your problem.
精彩评论