Current location: Hot Scripts Forums » Programming Languages » Other Languages » get latitude longitude for multiple data for Google Map


get latitude longitude for multiple data for Google Map

Reply
  #1 (permalink)  
Old 11-09-10, 08:43 AM
equatorlounge equatorlounge is offline
Newbie Coder
 
Join Date: Feb 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
get latitude longitude for multiple data for Google Map

get latitude longitude for multiple data for Google Map

so i have a complete list of 4000 houses, with their complete details in excel format, which, given their postal codes, i have to look for their locations and insert the latitudes and longitudes on Google Earth (their approximate values, based on my common sense, visually speaking ifever i come across an empty plot of land) back in the excel sheet. after that i shall then convert all this info into an xml sheet which i shall then deliver to my programmer for inserting in his flash application

thing is i managed to create and generate the xml sheet from the excel sheet, which was not easy, since there were loads of special characters (everything was in french, you can imagine the apostrophes and the special characters) and hard to convert to csv for importing via phpmyadmin.. but i did it ! a designer did programming finally !

however i still have to insert the longitudes and latitudes for 4000 houses on my sheet
im already starting it, cos my boss wants to see results for 4000 items, with all the searching and all the xml (nyehehe, the xml saved me time ^^), it will take me around 10000minutes which rounds up to approx 200hours, a month approx

is there any automated way or some way that can facilitate this hideous task ?

thanks to revert

ps: for those wanting to know how i managed the xls xml conversion with the special characters and the french accents taking care not to mess up the utf formats etc... email me
Reply With Quote
  #2 (permalink)  
Old 11-09-10, 10:00 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
You can use Google's Geocoding API.

Then you can loop through the list of houses, and then pass the postal code to this URL
PHP Code:

while (/* condition */)
{
    
$postcode /* Wherever this comes from */;
    
$url 'http://maps.googleapis.com/maps/api/geocode/json?address=France, ' $postcode '&sensor=false';

    if (!
$response file_get_contents($url))
        exit(
'Could not get response');

    
$response json_decode($response);

    
$latitude  $response->geometry->location->lat;
    
$longitude $response->geometry->location->long;

    
/* Update file or database with new data */

This code is completely untested and only for reference. But it should get you started.

EDIT: I just realized you posted this in "Other Languages", so not sure if PHP is an option.
Reply With Quote
Reply

Bookmarks

Tags
automatic, google maps, latitude, longitude


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 03:50 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.