close
Categories
maps urbanism

Geocoder API from the City of Toronto

I recently did some work around postal code and location search through my contribution with Civic Dashboard. Because of this, I came across the City of Toronto REST services for their geospatial data. Looking through Github code search and Google, I found very little information or other projects using those APIs.

I got in touch with the city and to my surprise, they came back to me with a full PDF: CoT Geocoder Technical Reference
Version 1.1
(I’ve uploaded it to my own GitHub). While this documentation was created in 2020, the APIs are still working in 2026 and are publicly accessible without authentication.

The 3 main APIs you can query with GET are:

https://map.toronto.ca/cotgeocoder/rest/geocoder/suggest
https://map.toronto.ca/cotgeocoder/rest/geocoder/findAddressCandidates
https://map.toronto.ca/cotgeocoder/rest/geocoder/reverseGeocode

Suggest service

https://map.toronto.ca/cotgeocoder/rest/geocoder/suggest?searchString=toronto&matchIntersection=1&matchAddress=1&matchPlacename=1&matchStreetName=1&retRowLimit=50

Meant to be used for an autocomplete search service. It is returning

  1. Places (parks, schools, etc)
  2. Street intersections
  3. Full addresses

However it only truly searches using the beginning of the string, “Mandela” won’t return Nelson Mandela Park Public School, only Nelson would. No postal code supported. I find the use of this API quite limited.

findAddressCandidates Service

https://map.toronto.ca/cotgeocoder/rest/geocoder/findAddressCandidates?singleLine=toronto&retrowlimit=50&matchAddress=1&matchIntersection=1&matchPlacename=1&matchPostalCode=1

This is likely the API you are looking for if you want to search for any address in the city and get their full address, municipal ward, municipality name (North York, Scarborough, etc) and their latitude/longitude. You can search by street address or postal code (full or partial).

reverseGeocode Service

https://map.toronto.ca/cotgeocoder/rest/geocoder/reverseGeocode?x=-79.51587&y=43.7033&matchAddress=1&matchIntersection=0

With this reverse geocoding service, you can provide a x/y coordinate (longitude/latitude) in the City of Toronto and obtain nearby addresses, their municipal ward and their municipality name.

Postman collection

On my Github project, I’ve added a Postman collection to quickly get you started on querying those APIs and also uploaded the full PDF documentation. The PDF also shows you how to query those APIs using the esri method.

Use cases?

The reason why I was looking for those APIs is because I wanted a way for a resident of Toronto to enter their postal code and get the name of their City Councillor for the Civic Dashboard Councillor page. While those APIs don’t return the councillor name, they return the municipal ward, which makes the matching easy.

For privacy reason, I also wanted a way for users to enter a partial postal code, 5 characters, instead of 6. In the large majority of cases, 5 digits postal code is precise enough to determine who the councillor is. While Civic Dashboard does not log the postal code query, I just know that some users will be more comfortable that way.

The findAddressCandidates API returns a list of addresses if you query a partial postal code (which isn’t quite the same as returning a definitive list of potential wards). Instead, you can increase the number of addresses returned (retRowLimit) and then loop over each of them to get all the possible ward values.

For example MSN 6H only has one councillor returned but M5T 1G has two.

BERJAYA
BERJAYA

If you end up using one of those geocoder RESTful services for a project, let me know, I’d be happy to update this blog post!

jeromegagnonvoyer's avatar

By jeromegagnonvoyer

Scaling Retail With Salesforce, Shopify & E-Commerce https://www.linkedin.com/in/jeromegagnonvoyer/

One reply on “Geocoder API from the City of Toronto”

Leave a comment

Design a site like this with WordPress.com
Get started