(* geocode 1.0.1 by Jim DeVona http://anoved.net/geocodesvc.html Version History: 1.0: 2 November 2006 1.0.1: 5 November 2006 (simplified comparison operators) Convert street addresses or intersections to latitude and longitude. Utilizes the free geocoding service provided by http://geocoder.us/ (therefore, this is most useful for addresses in the United States). This script is packaged as a Mac OS X Service using ThisService. The suggested installation location for the resultant service is: ~/Library/Services/Geocode.service ThisService provides the selected text to the bundled script as an argument to the process() handler, which should return the output. Errors cause the script to return with no value, which results in no change to the selected text. Unfortunately I have not yet figured out how to log or otherwise report useful error messages. Tools: http://wafflesoftware.net/thisservice/ ThisService: Package simple scripts as Mac OS X services http://www.petermaurer.de/nasi.php?section=servicescrubber Service Scrubber: trim the fat from your Services menu Geocoder.us References: http://geocoder.us/help/ (Geocoder API reference) http://geocoder.us/dist/eg/clients/xmlrpc.pl AppleScript References: http://developer.apple.com/documentation/AppleScript/Conceptual/ soapXMLRPC/chapter2/chapter_2_section_3.html http://developer.apple.com/documentation/AppleScript/Conceptual/ soapXMLRPC/chapter3/chapter_3_section_2.html#//apple_ref/ doc/uid/TP30001126-//apple_ref/doc/uid/20001723-BAJGDBGC *) on process(address) try -- submit a geocoding request to geocoder.us tell application "http://rpc.geocoder.us/service/xmlrpc" set response to call xmlrpc {method name:"geocode", parameters:{address}} end tell on error -- Error: network problem (check URL, query, connection) return end try -- Error: invalid address and/or missing city, state or ZIP if the (count of response) is 0 then return end if -- handle each returned location set coords to "" repeat with location in response -- separate multiple results with semicolons if coords is not equal to "" then set coords to coords & "; " try -- get coordinates from location set lat to (lat of location) as string set long to (long of location) as string on error -- Error: address parsed but not found return end try -- append this location to coordinate output set coords to coords & lat & ", " & long end repeat return coords end process