Get latitude and longitude based on city, zip or streetname

后端 未结 4 2170
悲&欢浪女
悲&欢浪女 2020-12-30 17:12

In my current android application, I would like to get the geocordinates based on an entered city name, street name or zip code. How can I accomplish this?

Best Rega

4条回答
  •  余生分开走
    2020-12-30 17:46

    Hi try the following code to get Geocode point from given address.

    List
    foundGeocode = null; /* find the addresses by using getFromLocationName() method with the given address*/ foundGeocode = new Geocoder(this).getFromLocationName("address here", 1); foundGeocode.get(0).getLatitude(); //getting latitude foundGeocode.get(0).getLongitude();//getting longitude

提交回复
热议问题