Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate google map based on UK postcode

Is it possible to do a google map lookup using the google maps API from a UK postcode? I know you can search by UK postcode on their website, but this converts to lat / long. I don't have access to the PAF database to be able to convert to long / lat.

An example:

Users have an item to sell. One of the details of that item is a postcode, where the user / item is located. When the items are displayed on the front end of the website, there needs to be a google map of the items location generated using the postcode.

If this is possible, how do I do it?

like image 695
Robin Barnes Avatar asked Dec 20 '08 16:12

Robin Barnes


People also ask

Can you put postcodes into Google Maps?

To add an address and postcode to the Map, please enter your address into the search bar of the Map. If your address doesn't show fully, remove any house numbers or apartment numbers and the marker should locate you in the middle of the road.

Can Excel map UK postcodes?

Using Mapline, you can easily create a territory map of UK postcode districts like these. Simply download your map from Mapline, overlay your Excel data, and perform district-level analyses on UK postcode boundaries.

How do you format a UK postcode?

It consists of a numeric character followed by two alphabetic characters. The numeric character identifies the sector within the postal district. The alphabetic characters then define one or more properties within the sector. For example: PO1 3AX PO refers to the postcode area of Portsmouth.


3 Answers

What 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 their postcode.

You can change the size from 200x200 or the marker colour, label etc. too if you wish.

like image 60
dbramley Avatar answered Oct 19 '22 12:10

dbramley


You can do it purely though Google maps.

I did it for a client earlier this year and have just had to do a few modifications. I also did some direction-grabbing. It's all pretty simple but best viewed in context.

Take a look at the source of the page I made.

like image 26
Oli Avatar answered Oct 19 '22 13:10

Oli


Google does not provide a geocoding api in the UK because of the licensing model the Royal Mail releases postcode data under.

The are however some tools that people have written that enable geocoding using google, but that would be technically illegal afaik.

One option then is to use one of the several uk geocoding providers. I don't want to sound lazy but they are easily googled. They typically charge a few pence per geocode.

like image 40
Ben Aston Avatar answered Oct 19 '22 13:10

Ben Aston