Create a google map based on a UK zip code

Can I search on a Google map using the google maps API with an English zip code? I know you can search by british zip code on your website, but that converts to lat / long. I do not have access to the PAF database to be able to convert to long / lat.

Example:

Users have an item for sale. One of the details of this item is the zip code in which the user / item is located. When elements are displayed on the front of the website, there must be a google map of the location of the elements generated using the zip code.

If possible, how to do it.

thanks

+6
google-maps paf
source share
8 answers

You can do it cleanly though google maps.

I did this for the client earlier this year and just had to make a few modifications. I also worked a little. All of this is quite simple, but is best seen in context.

Look at the source on the page I made .

+4
source share

How about using:

<img src="http://maps.google.com/maps/api/staticmap?center=POSTCODEHERE&zoom=14&size=200x200&maptype=roadmap&markers=color:ORANGE|label:A|POSTCODEHERE&sensor=false" style="float: right"> 

Then replace POSTCODEHERE in the two sections above with your zip code.

You can change the size from 200x200 or marker color, shortcut, etc., if you want.

+11
source share

Google does not provide geocoding api in the UK due to the licensing model in which Royal Mail releases zip code data.

However, there are some tools that people have written that allow you to use geocoding using Google, but that would be technically illegal afaik.

One option is to use one of several geocoding providers. I do not want to sound lazy, but they are easily distorted. Usually they charge a few pence for each geocode.

+1
source share

It is (now) very easy to do this using the Google LocalSearch API:

 function usePointFromPostcode(postcode, callbackFunction) { localSearch.setSearchCompleteCallback(null, function() { if (localSearch.results[0]) { var resultLat = localSearch.results[0].lat; var resultLng = localSearch.results[0].lng; var point = new GLatLng(resultLat,resultLng); callbackFunction(point); } else { alert("Postcode not found!"); } }); localSearch.execute(postcode + ", UK"); } 

callbackFunction() will get a GLatLng object, in my experience, very accurate coordinates. In fact, it is trivial to then pass this GLatLng to the getLocations () method of GClientGeoCoder and get full Placemark information that includes details down to the address range level (e.g. 1-18 Foo Street).

The real question is: is this legal?

+1
source share

you need a PAF database, each zip code is held as a polygon, so if you do not have this source data, you cannot limit the search to a polygon or radius around a center point.

postoffice will sell you all the data you need, prices start at £ 85pa.

PS. Google does this because they have a PAF database, when you enter the zip code, they look at the center and show what's on their map.

0
source share

The people behind openstreetmap.org are working on a free equivalent - I don't know how ready it is for prime time, but FWIW:

http://freethepostcode.org/

0
source share

No one seems to be looking very hard ... there is a freely available list of UK zip codes and positions there . More importantly, all of it is redundant, as Google Maps provides the ability to search by zip code to get started. Even the use of the API is redundant additional if the service is provided over the Internet ... there is nothing that could prevent you from sending an HTTP request yourself and displaying parts of the returned data if you save any necessary copyright messages, etc.

0
source share

http://www.websemantics.co.uk/resources/postcode_to_coordinates_conversion_tool/

The site will provide you with longitude and latitude, which you can place directly in your Google code.

0
source share

All Articles