Updated 2012-06-26 00:14:11 by RLE

DL http://geocoder.us is a service that translates street addresses to longitude and latitude. Such coords are a necessity for some services such as Google's map API.

Professional Approach

(to come)

Simple Approach

Here is the simplest solution with no error checking and no extensive use of packages. (A more professional version - to come - would use an XML package and provide error checking and a million options.

Note - this is ONLY to be used by non-profit purposes. See the http://geocoder.us web page for commercial or for-profit uses.
 # comment out next line to read from command line
 set argv "100 Bureau Dr, Gaithersburg, MD  20899"
 regsub -all " " $argv "+" encodedURL

 set geocoder "http://rpc.geocoder.us/service/rest/geocode?address=$encodedURL"
 set data [http::data [http::geturl $geocoder]]

 regexp "<geo:long>(.*)</geo:long>" $data X long
 regexp "<geo:lat>(.*)</geo:lat>"   $data X lat

 puts "long: $long"
 puts "lat : $lat"