简体   繁体   中英

To get latitude and longitude from user given location

In my app the user gives the location name for eg: "New York". in the text field, app gives the location ie latitude & longitude of New York. Which method I should use . please help me. Thanks.

You can use this Google Geocoding API below,

http://maps.googleapis.com/maps/api/geocode/json?address=Winnetka&sensor=false

In the place of address=Winnetka you can write address= New York,

You will get the lat and long in the xml responce so just parse the output.

Enjoy!

您还可以使用Places Autocomplete API (可能会发现有用)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM