Convert UK Postcode to Lat / Lng in Objective-C iOS iPhone etc [duplicate]
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.
精彩评论