[Chicago-talk] Geo-Data

Edward Summers ehs at pobox.com
Sun Oct 2 11:06:52 PDT 2005

I'm not sure if this will help much but you can get long/lat data  
from one of the geocoder.us web services. Here's a relatively simple  
program that uses their REST api to read in address and get the  
coordinates for them. I threw some Chicago sites in there to get  



use RDF::Simple::Parser;
use URI::Escape;
use Data::Dumper;
use strict;
use warnings;

while ( my $site = <DATA> )
     my ($name,$address) = split/:/,$site;
     my @coords = geocode($address);
     next if ! @coords;
     print "$name => $coords[0] ; $coords[1]\n";

sub geocode
     my $addr = uri_escape(shift);
         my @results = RDF::Simple::Parser
             ->parse_uri( "http://rpc.geocoder.us/service/rest? 
address=$addr" );
         return ($results[2][2], $results[3][2]);

Art Institute:847 W Jackson Blvd, Chicago IL
Hancock Observatory:875 N. Michigan Avenue, Chicago IL
Sears Tower SkyDeck:233 S. Wacker, Chicago IL
Lincoln Park Zoo:2200 N Cannon Dr Chicago IL
Chicago Mercantile Exchange:30 S. Wacker Drive Chicago IL


The output should look something like:

Art Institute => -87.648712 ; 41.878008
Hancock Observatory => -87.624301 ; 41.898793
Sears Tower SkyDeck => -87.636752 ; 41.879003
Lincoln Park Zoo => -87.632908 ; 41.922300
Chicago Mercantile Exchange => -87.636891 ; 41.881567

More information about the Chicago-talk mailing list