1

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 generated by the app and would push to something like the above.

Balanivash
  • 6,709
  • 9
  • 32
  • 48

2 Answers2

4

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.

jigneshbrahmkhatri
  • 3,627
  • 2
  • 21
  • 33
4

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.