Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2010
    Posts
    94
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Converting Postcode or Address to Lat/long for google maps

    EDIT: I figured this one out for myself

    You can either close this or for reference purposes here's how I did it -

    Code:
     <?
     $query = mysql_query("SELECT * FROM inserttablename");
     while ($row = mysql_fetch_array($query)){
    
     $code=$row['postcode'];
     
     $q = "http://maps.googleapis.com/maps/api/geocode/json?address=$code&sensor=false"; 
    
     $json = file_get_contents($q);
     $details = json_decode($json);
     $lat=$details->results[0]->geometry->bounds->northeast->lat;
     $lng=$details->results[0]->geometry->bounds->northeast->lng;
     
     echo ("addMarker($lat, $lng,'<b>Here you are!</b>');\n
     
     
     ");
     
     
     }
     ?>
    Last edited by swiltch; 10-29-2013 at 11:44 PM. Reason: Solved

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,033
    Thanks
    15
    Thanked 240 Times in 240 Posts
    You can find just about all the data on postcodes here, in several formats.

    http://www.doogal.co.uk/UKPostcodes.php

    The only problem is, it's a LOT of data, so you may need to condense it somewhat to use it.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  • Users who have thanked DrDOS for this post:

    swiltch (10-31-2013)

  • #3
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    does anyone know that if streetmap still provides api for geo info?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •