Jump to content

Script to geocode DB of postcodes and store in DB


mackin

Recommended Posts

I am using Googlemaps to show a group of businesses around a central point. I can dynamically generate the map based on the location. I have a DB of postcodes that I need to geocode into LAT and LONG - and store them in the same field as postcode - so I can use lat&long to plot points on the map.

 

Does anyone have a script for this or know where I should begin?

Cheers

Link to comment
Share on other sites

Thx for the reply - but I dont need to go that far - all i really need to do is add latitude and longitude information to my postcodes - using google geocode to create them.

 

$pc1 = 'http://maps.google.com/maps/geo?q='.$postcode1.',+UK&output=csv&sensor=false&key=ABQIAAAAcclaxnepdvvxx5D2PAnHtRSLcuoGw6G6HnB4VN4WqoMz7tmtKhTHGV82iKKTXvAg7YFpCFA6ptRc9g';
$data1 = file_get_contents($pc1);
$result1 = explode(",", $data1);
$custlat1 = $result1[2];
$custlong1 = $result1[3];

 

I used this code to do single entries - but i want to do 1100 postcodes in a similar fashion

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.