Legal Land Descriptions for Developers — API Integration Guide
How to parse, convert, and validate Canadian legal land descriptions in software. REST API, TypeScript SDK, and batch processing with real code examples.
Legal Land Descriptions for Developers
Canadian legal land descriptions don't follow a single standard — a software application might receive LSD 06-32-048-07W5, NW-25-24-1-W5, an NTS block reference, or an Ontario lot and concession in the same dataset, all referring to different parcels in different provinces. If you're building an application that handles Canadian land data, parsing and geocoding these formats is a core problem.
This guide explains how Canadian survey systems work from a developer's perspective and how to integrate the Township Canada API into your application.
Why Developers Encounter Legal Land Descriptions
Legal land descriptions appear in datasets across oil and gas, agriculture, real estate, and insurance. A few common scenarios:
- Well data imports: Upstream oil and gas databases export well locations as DLS strings (e.g.,
100/06-32-048-07W5/00). Your application needs GPS coordinates to render them on a map. - Agricultural records: AFSC crop insurance claims, grain delivery permits, and CAIS applications reference quarter sections. Batch geocoding a farmer's field list is a routine data prep step.
- Title searches: Land titles in Alberta, Saskatchewan, and Manitoba use the DLS grid. An address search tool needs to handle both civic addresses and legal land descriptions.
- ETL pipelines: Geospatial ETL jobs loading provincial records into a data warehouse often encounter mixed LLD formats in the same column.
Understanding the Format Before Parsing
Canadian legal land descriptions come in several systems. The most common for developers building western Canadian apps:
DLS quarter-section: NW-25-24-1-W5 — Direction (NW), Section (25), Township (24), Range (1), Meridian (W5). Used in Alberta, Saskatchewan, Manitoba, and the BC Peace River block.
LSD: 06-32-048-07W5 — LSD number (06), Section (32), Township (048), Range (07), Meridian (W5). A 40-acre subdivision of a DLS section. The primary addressing system for AER well licences.
UWI (Unique Well Identifier): 100/06-32-048-07W5/00 — The middle portion is the LSD location. Strip the prefix and suffix to get the raw DLS address.
NTS: Map sheet and block/unit references used in British Columbia and for resource permits across Canada. Formats vary — the Township Canada API normalizes these on input.
Avoid trying to write your own parser for these formats. Edge cases include legal subdivisions numbered 13–16 (the access road allowances), historical township irregularities near the US border, and BC's PNG Grid references that look like NTS but aren't. The Township Canada API handles all of these correctly.
Converting with the REST API
The Township Canada Search API accepts a legal land description string and returns a GeoJSON Feature with coordinates and metadata. Authentication uses an X-API-Key header.
const response = await fetch('https://api.townshipcanada.com/v1/search', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.TOWNSHIP_API_KEY,
},
body: JSON.stringify({ query: '06-32-048-07W5' }),
});
const result = await response.json();
// result.geometry.coordinates → [-116.8234, 53.1421]
// result.properties.system → "lsd"
// result.properties.province → "AB"
The response includes the detected survey system, province, and a boundary polygon for the parcel. For quarter sections, the boundary is the 160-acre extent. For LSDs, it's the 40-acre extent.
Using the TypeScript SDK
If you're using Node.js (v18+), npm install @townshipcanada/sdk gives you a typed client that wraps the REST endpoints:
import { TownshipClient } from '@townshipcanada/sdk';
const client = new TownshipClient({ apiKey: process.env.TOWNSHIP_API_KEY });
// Single conversion
const location = await client.search('NW-25-24-1-W5');
console.log(location.lat, location.lng); // 52.1847, -114.6302
// Reverse geocode — GPS coordinates to legal description
const lld = await client.reverse({ lat: 53.1421, lng: -116.8234 });
console.log(lld.description); // "LSD 06-32-048-07W5"
// GeoJSON boundary polygon
const boundary = await client.boundary('NW-25-24-1-W5');
// Returns GeoJSON Polygon for the 160-acre quarter section
The SDK also exposes autocomplete() for building typeahead search interfaces — useful if your users are typing legal descriptions manually and need format validation as they type. See the full SDK docs on npm for all available methods.
Batch Processing
For pipeline jobs or bulk imports, the Batch API accepts up to 100 LLDs per request and auto-chunks larger arrays:
const results = await client.batchSearch([
'06-32-048-07W5',
'NE-14-32-21-W4',
'NW-25-24-1-W5',
// ... up to thousands of entries; SDK handles chunking automatically
]);
results.forEach(({ input, lat, lng, error }) => {
if (error) {
console.error(`Failed: ${input} — ${error}`);
} else {
console.log(`${input}: ${lat}, ${lng}`);
}
});
Failed lookups return an error field rather than throwing, so one bad description doesn't abort the batch. For details on the web-based batch tool, see the batch conversion guide.
Running DLS Conversion Inside Snowflake
If your data pipeline runs on Snowflake, Township Canada offers a SQL-native option. The Snowflake External Function integration lets you call TOWNSHIP_CONVERT(lld_column) directly in SQL — no Python UDF setup, no export step. The function calls the Township Canada Batch API via an AWS Lambda proxy. This is the fastest path for data teams who already have their well or field data in the warehouse.
Common Mistakes
Assuming a fixed format: Canadian LLDs vary by province and system. A parser that handles Alberta DLS will break on BC NTS references or Ontario lot and concession notation. Use the API rather than writing your own regex.
Ignoring the meridian: 06-32-048-07W5 and 06-32-048-07W4 look nearly identical but resolve to locations 250 kilometres apart. Always preserve the full string — including the meridian — when storing LLDs in your database.
Treating the result as point-only: Legal land descriptions describe areas, not points. A quarter section is 160 acres. If you're doing proximity calculations, use the boundary polygon rather than the centre point.
Start Integrating
Get an API key at townshipcanada.com/api. The Build tier starts at $20/month for 1,000 requests — enough to prototype or run a low-volume import job. For the data structures involved, the DLS system overview and LSD overview explain the survey grid hierarchy in full detail.
For a working example using NW-25-24-1-W5, try it in the converter to see the parcel boundary, GPS coordinates, and surrounding survey grid before writing a single line of code.
Related Articles
Batch Convert Legal Land Descriptions — Process Thousands of LLDs at Once
Convert hundreds or thousands of legal land descriptions to GPS coordinates at once. Upload a CSV and get results in seconds.
DLS to GPS Converter — Convert Dominion Land Survey to Coordinates
Convert DLS (Dominion Land Survey) descriptions to GPS coordinates. Supports sections, quarter sections, and LSDs across Alberta, Saskatchewan, Manitoba, and BC.
The Dominion Land Survey (DLS) System Explained
How the DLS grid divides Western Canada into townships, ranges, sections, and quarter sections. History, format, examples, and conversion guide.