Canadian Geocoder + XML API

A geocoder is a system that takes a street address and converts it to an (approximate) latitude and longitude for use in GPS navigation, online cartography, and similar applications. MapQuest has a nice online tutorial for different geocoding algorithms, with illustrations.

A new, extremely simple geocoder has just come online for Canada, named (unsurprisingly) geocoder.ca. The app includes both an HTML interface and an XML (and HTTP) API. Here is an example of a GET URL for a simple API call to geocode 1 Lindbergh, Ottawa, Ontario:

http://www.geocode.ca/?addresst=lindbergh&stno=1&city=ottawa&prov=ON&geoit=xml

Here’s the XML document returned in the HTTP response:

<?xml version="1.0" encoding="iso-8859-1" ?>
<geodata>
        <latt>45.3358320000</latt>
        <longt>-75.6864510000</longt>
</geodata>

It’s also possible to send your own transaction ID and have it returned in the XML. If I append “&id=foobar” to the above URL, I get this back:

<?xml version="1.0" encoding="iso-8859-1" ?>
<geodata>
        <latt>45.3358320000</latt>
        <longt>-75.6864510000</longt>
	<id>foobar</id>
</geodata>

Finally, like many REST applications, this one has its own ad-hoc error-reporting scheme:

<?xml version="1.0" encoding="iso-8859-1" ?>
<geodata>
        <error>
                <code>004</code>
                <description>Specify a Canadian province two letter code.</description>
        </error>
        <latt>
        <longt>-

</geodata>

This is another great example of how plain XML and HTTP make it easy to provide a public API.

This entry was posted in Uncategorized and tagged . Bookmark the permalink.

3 Responses to Canadian Geocoder + XML API

  1. Steve Loughran says:

    One of the problems with a simple lat/long tuple is you need to know which datum it is. Get the wrong model of the planet and your points appear off by many tens of metres. WSG-84 is the common one for GPS points, but with US maps often using NAD27, you can get caught out. Better to use single-datum coordinate systems like UTC or OSGB, if you can.

  2. Zeljin M says:

    It’a kinda hard to find a good solution for geocoding canadian addresses.

    These guys offer an inexpenssive solution for Geocoder for Canadian address.
    http://www.serviceobjects.com/products/geocode_canada_web_service.asp

    I like the fact that it’s a real company. I like what i see so far.

  3. nick says:

    Well Zeljin, serviceobjects charges 50 times more per geocoding transaction than geocoder.ca does for comercial uses. how is that cheaper?
    plus i do not see any free offerings on their site for non-for-profit uses.

Comments are closed.