开发者

Convert UK Postcode to Lat / Lng in Objective-C iOS iPhone etc [duplicate]

This question already has an answer here: Retrieving Current Location and Zip using Geolocation Button (1 answer) Closed 5 years ago.

I am wondering how I can convert a UK Postcode to Lat / Lng within my app so that I can pass this onto a URL.

I am parsing my data as JSON to be used later in a map

eg: http://www.thebigfishexperience.org.uk/sources/ajax/venue-json.php?lat=52.5612743&lng=-0.2732938&radius=10

The lat and lng parameters would be generate开发者_运维技巧d by the app and would push to something like the above.


If you have postcode, you need to do reverse geocoding but that can be done using MapKit. Check this iPhone Development – Reverse Geocoding

If you do not want to use MapKit, you can request to url http://maps.google.com/maps/geo?q=UKPOSTCODE&output=xml, and parse xml, you will get latitude longitude.


To convert a UK postcode to a Latitude and Longitude, use Google's Geocoding API.

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

You will receive a JSON response which you can easily parse to populate your hidden fields.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜