Geocode USA and Canada

Create a Data Account - for Data Products Create an API Account - for XML/Json/CSV API

User supplied material to help you with using geocoder.ca - send us a note if you wish to contribute to this page

Note: This code is supplied by various contributors and comes with no warranties on our part. There is probably much more client code in other programming languages on the web that you can find by doing a google search. If you find something you like and find useful in your favorite programming language, let us know.

Geocoder.ca Autocomplete class in javascript

Bash one liner for batch geocoding CSV/Text filesSeptember-3-2016: Of all the various clients interfacing with our geocoding API, the simplest one deserves some praise. Here is a bash one liner that takes as input a CSV file of locations, and outputs the file with the location information appended at the end of each line:
#!/bin/bash
while IFS='' read -r line || [[ -n "$line" ]]; do
    echo $line,`curl -X POST -d locate="$line" -d geoit="csv" https://geocoder.ca`;
done < "$1"
Save as geocode.sh then chmod a+x geocode.sh then run it as:
./geocode.sh input.csv>output.csv

Your input file might look something like:
input.csv

20 WYPER SQ , Toronto, ON M1S0B3
415 LAKEWAY, Ding Dong, TX 76549
Yonge and Dundas, Toronto
and the output

output.csv

20 WYPER SQ , Toronto, ON M1S0B3,200,1,43.790920,-79.245789
415 LAKEWAY, Ding Dong, TX 76549,200,0.8,30.976936,-97.817796
Yonge and Dundas, Toronto,200,0.9,43.655778,-79.380650
Four columns were appended to the input file. The status (200 success), the confidence score (a number between 0 and 1, with 1 being best match), the Latitude and the Longitude.

Begin forwarded message:

Date: November 5, 2010 10:19:31 PM GMT+01:00 To: [email protected] Subject: GeoCoder PHP library Hi there, Last October, I wrote a PHP library for the GeoCoder.ca website (actually, I took code from a forum [1] and tidied it up). I haven't implemented a couple of functions since the project I worked on didn't need it at the time. Maybe you might be interested in forking it from GitHub? [2] [1] https://groups.google.com/group/Google-Maps-API/browse_thread/thread/6012540c29625bf2/f684d8edaf90b9f6 (didn't load for me just now) [2] https://github.com/sillygwailo/GeoCoder -- Richard Eriksson justagwailo.com


Data Definiton File (Jan 18, 2006) | A php4 code example - (March 21, 2006) | CPAN geocoder client perl module | Java code for using geocoder.ca | Another php example | A php5 example | Python class which will process geocoder transactions | An ASP C# example | Node.js example


A Data definition file for geocoder.ca xml port output - received today on Jan 18, 2006.
Hello,

I wanted to drop you a line and thank you for the wonderful
service. I used it yesterday to run a test data sample and it
worked very smoothly.

Also, as a part of my test integration, I created a DTD file
and I thought it might be useful for other people too. I am
attaching it to this e-mail

-- Best regards, Anthony

File: GEOCODER_CA_RESPONSE.dtd



Hello!    I have created a php4 script that retrieves geodata
information from your site. Perhaps it would be a good idea to add
this to your php examples as right now you only have php5. The only
drawback with my script is you need DOMPHP installed (which should be
installed on almost all servers, so this shouldn't be a problem - use
phpinfo() to check!)

Cheers!

Patrick Hayes

Script is below!