0

I have a website that uses UK postcodes lat and lon co-ordinates to allow members to search within a given distance but this only uses basic areas (LS2, WF1, etc). What I want to do is to get the lon/lat co-ordinates for the full postcode so that the search is more precise. I've heard that you can do this with a Google API but I have no idea if this will give me the same details as I have now or how I could incorporate it into my site. Here is a rundown of what happens now:

>     User enters basic postal area into a form (LS2 for example)
>     It is then passed (with other form data) through JQuery Post to php file
>     PHP file sorts out the city, county, lon, lat information from postcodes table based on the given post area
>     + Enters the data into a table with other form data
>     Result is echoed back and user is redirected if successful

Is there a way of adding the geo-coding script into the php file & will it get the information that I require? I'd also like this to work outside of the UK

  • There's the Post Office PAF data will give you details of all UK postcode, or the Ordnance Survey's CodePoint Open which can give you a Lat/Long lookup for postcodes - but I'm unclear what your question actually is – Mark Baker Aug 31 '13 at 15:41
  • Have A look at these API's By Google: [Google Maps](https://developers.google.com/maps/documentation/javascript/reference?hl=en) And [Googles Geocoding Api](https://developers.google.com/maps/documentation/geocoding/). The process you are looking for is called geocoding.. – Vedant Terkar Aug 31 '13 at 15:43
  • @MarkBaker I'm basically looking for a simple solution to find the lat lon co-ordintates of a full postcode (LS1 6YD), rather than just the area (LS1) but still use the form and php script I have now - So, rather than get the information from a Postcodes database, get it from the Google geo-coding script – user2711490 Aug 31 '13 at 15:50
  • OK, though you could get it from a full street-level postcode database instead of one that only handles areas – Mark Baker Aug 31 '13 at 15:51
  • Thanks @VedantTerkar - I did have a look at that before but I couldn't work out which part would work for postal areas? I only really want to get the Lat, Lon, Town, County & if possible village based on the full postcode given – user2711490 Aug 31 '13 at 15:51

0 Answers0