mackin Posted January 13, 2012 Share Posted January 13, 2012 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 Quote Link to comment Share on other sites More sharing options...
Philip Posted January 13, 2012 Share Posted January 13, 2012 http://www.phpfreaks.com/forums/index.php?topic=208965.0 should get you started Quote Link to comment Share on other sites More sharing options...
mackin Posted January 13, 2012 Author Share Posted January 13, 2012 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 Quote Link to comment Share on other sites More sharing options...
Philip Posted January 13, 2012 Share Posted January 13, 2012 Within the link are a few external links to databases with postcode -> lat/long. Of course you'll need to get the one that is for the correct country. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.