Mapacan
← All Guides & Resources • Developer Reference

Canadian Reverse Geocoding API Guide

Convert GPS coordinates into verified civic addresses, building numbers, and postal codes across Canadian provinces with sub-second response times and zero coordinate logging.

Understanding the Nominatim /reverse Endpoint

While forward geocoding converts textual queries into coordinates, reverse geocoding performs the inverse spatial query: finding the closest mapped point of interest, building polygon, or road centerline to a specific (lat, lon) coordinate pair.

Zoom Level Precision
zoom Parameter (3 to 18)

Control address granularity. Use zoom=18 for exact rooftop building numbers, zoom=16 for street-level, or zoom=10 for municipal districts.

Canadian Data Sources
OSM + StatCan (ODA & NAR)

Powered by OpenStreetMap joined with Statistics Canada's Open Database of Addresses (ODA) and National Address Register (NAR) to ensure precise rooftop coverage across Canada, even in non-urban delivery zones.

API Request Format

Send an authenticated HTTP GET request to the /reverse endpoint with the target coordinates:

HTTP Endpoint

GET /reverse
GET https://mapacan.ca/reverse?lat=43.648768&lon=-79.381692&format=jsonv2&addressdetails=1
• lat: Latitude in decimal degrees (e.g., 43.648768).
• lon: Longitude in decimal degrees (e.g., -79.381692).
• format: Set to jsonv2 for structured JSON.
• addressdetails: Set to 1 to receive parsed civic address attributes.

Response Structure

The response provides the closest place object with full Canadian regional hierarchy:

{
  "place_id": 351535396,
  "licence": "Data © OpenStreetMap contributors, ODbL 1.0",
  "osm_type": "way",
  "osm_id": 27767627,
  "lat": "43.6487681",
  "lon": "-79.3816921",
  "category": "building",
  "type": "office",
  "place_rank": 30,
  "importance": 0.45,
  "addresstype": "building",
  "name": "First Canadian Place",
  "display_name": "First Canadian Place, 100, King Street West, Financial District, Old Toronto, Toronto, Ontario, M5X 1C7, Canada",
  "address": {
    "building": "First Canadian Place",
    "house_number": "100",
    "road": "King Street West",
    "neighbourhood": "Financial District",
    "city": "Toronto",
    "state": "Ontario",
    "ISO3166-2-lvl4": "CA-ON",
    "postcode": "M5X 1C7",
    "country": "Canada",
    "country_code": "ca"
  },
  "boundingbox": [
    "43.6484693",
    "43.6490629",
    "-79.3821127",
    "-79.3812709"
  ]
}

Implementation Examples

Python 3 (requests) reverse_geocode.py
import requests

API_KEY = "your_server_key_here"
BASE_URL = "https://mapacan.ca/reverse"

def reverse_geocode(lat: float, lon: float):
    response = requests.get(
        BASE_URL,
        headers={"Authorization": f"Bearer {API_KEY}"},
        params={
            "lat": lat,
            "lon": lon,
            "format": "jsonv2",
            "addressdetails": 1,
            "zoom": 18  # Rooftop-level resolution
        },
        timeout=5
    )
    response.raise_for_status()
    data = response.json()
    
    addr = data.get("address", {})
    return {
        "formatted_address": data.get("display_name"),
        "street_number": addr.get("house_number"),
        "street_name": addr.get("road"),
        "city": addr.get("city") or addr.get("town") or addr.get("municipality"),
        "province": addr.get("state"),
        "postal_code": addr.get("postcode")
    }

# Example: Queen's Park Legislative Assembly, Toronto
result = reverse_geocode(43.662892, -79.391656)
print(result)
PHP 8.2+ (cURL / HTTP) ReverseGeocodeService.php
<?php

use Illuminate\Support\Facades\Http;

function reverseGeocodeCanadianCoords(float $lat, float $lon, string $apiKey): ?array
{
    $response = Http::withToken($apiKey)
        ->timeout(5)
        ->get('https://mapacan.ca/reverse', [
            'lat' => $lat,
            'lon' => $lon,
            'format' => 'jsonv2',
            'addressdetails' => 1,
            'zoom' => 18,
        ]);

    if (! $response->successful()) {
        return null;
    }

    $data = $response->json();
    $address = $data['address'] ?? [];

    return [
        'full_address' => $data['display_name'] ?? null,
        'civic_number' => $address['house_number'] ?? null,
        'street' => $address['road'] ?? null,
        'city' => $address['city'] ?? $address['town'] ?? $address['municipality'] ?? null,
        'province' => $address['state'] ?? 'ON',
        'postal_code' => $address['postcode'] ?? null,
    ];
}
🍁 Canadian Fleet & Telematics Privacy

Driver Coordinates Are Protected Under PIPEDA & Law 25

GPS coordinates transmitted from mobile devices, dispatch systems, and field tablets are recognized as personal identifiable information (PII) under Canadian law. Transmitting driver telemetry to US-based geocoding clouds subjects your location data to extraterritorial US CLOUD Act surveillance and indefinite access logging. Mapacan processes all reverse geocoding queries in-memory on bare-metal Canadian hardware in Beauharnois, Quebec with zero disk logs.