Snowflake DLS Legal Land Description Enrichment for Oil and Gas
Convert DLS legal land descriptions to GPS coordinates directly in Snowflake SQL for oil and gas well data, pipeline routes, and regulatory filings.
Snowflake DLS Legal Land Description Enrichment for Oil and Gas
Canadian oil and gas companies store well locations, pipeline crossing points, and surface lease references as DLS legal land descriptions inside Snowflake. Production databases, AER filing records, and asset management tables all reference locations like NW-36-42-3-W5 or LSD 06-32-048-07W5. Those descriptions are precise for regulatory purposes, but useless for spatial analysis, mapping, or proximity calculations until they become GPS coordinates.
Until now, converting DLS data inside Snowflake meant exporting it first. Township Canada's Snowflake External Function changes that — DLS legal land description enrichment happens directly in SQL, inside your warehouse, without an export step.
Why DLS-Referenced Data Needs Enrichment at Scale
Every well licence issued by the AER contains a DLS legal land description. Pipeline permits reference section crossings. Surface leases specify quarter sections. When an operator's Snowflake warehouse holds thousands of these records, the data is complete for regulatory purposes but incomplete for analysis.
Common scenarios that require DLS enrichment in oil and gas:
- Well portfolio mapping: Plotting 5,000 active wells on a dashboard requires GPS coordinates. DLS descriptions alone don't render on a map.
- Proximity analysis: Calculating the distance between a proposed drilling location and the nearest pipeline or water source requires lat/lng pairs, not section-township-range references.
- Regulatory filing preparation: AER Directive 056 applications need both the legal land description and verified GPS coordinates. Pulling those from the warehouse — already enriched — saves a manual conversion step before each filing cycle.
- Production field analytics: Joining well locations against geological formations, soil types, or municipal boundaries requires coordinates that can feed Snowflake's geospatial functions like
ST_DISTANCEandST_MAKEPOINT.
When the dataset is 50 rows, manual conversion is tolerable. When it's 50,000 rows and updates monthly from AER public data, manual conversion breaks.
The Export-Convert-Reimport Problem
Before Snowflake DLS enrichment, the standard workflow looked like this: export the legal land descriptions from Snowflake to CSV, run them through a conversion tool or Python script, then load the enriched results back into Snowflake.
That workflow has three problems that compound at scale:
Broken data lineage. The moment data leaves Snowflake, tracking stops. There's no record of which source table version was used, when the coordinates were generated, or whether the conversion ran against the latest data.
Manual re-runs. If the wells table updates daily from new AER filings, someone has to re-run the conversion daily. In practice, the enriched table drifts from the source within a week.
Error isolation. When 200 of 50,000 records fail to convert — a transposed range number, a missing meridian — diagnosing those failures in a disconnected workflow means switching between tools and matching row numbers across files.
The SQL-Native Fix: Township Canada External Function
The Township Canada External Function lets you call TOWNSHIP_CONVERT() directly in Snowflake SQL. Behind the scenes, Snowflake routes each batch of rows through an AWS API Gateway proxy to the Township Canada Batch API. GPS coordinates come back as structured JSON, mapped to the original rows.
From the analyst's perspective, it's a SQL function:
SELECT
well_id,
well_name,
legal_land_description,
TOWNSHIP_CONVERT(legal_land_description):latitude::FLOAT AS latitude,
TOWNSHIP_CONVERT(legal_land_description):longitude::FLOAT AS longitude
FROM aer_wells
WHERE province = 'AB'
LIMIT 100;
No Python notebook. No CSV export. No separate ETL pipeline. The conversion happens where the data lives.
Enriching an AER Wells Table
For a one-time enrichment of a large table, the CTAS (Create Table As Select) pattern runs the conversion once and stores the results:
CREATE TABLE wells_enriched AS
SELECT
w.*,
TOWNSHIP_CONVERT(w.legal_land_description):latitude::FLOAT AS latitude,
TOWNSHIP_CONVERT(w.legal_land_description):longitude::FLOAT AS longitude
FROM wells w;
A 12,000-row wells table processes in about two minutes. The enriched table stays in Snowflake with full lineage to the source. When the source updates, re-run the query.
Once GPS coordinates are in the table, Snowflake's built-in geospatial functions open up analysis that previously required exporting to ArcGIS or QGIS:
-- Find all wells within 10 km of a compressor station
SELECT
well_id,
legal_land_description,
ST_DISTANCE(
TO_GEOGRAPHY(ST_MAKEPOINT(longitude, latitude)),
TO_GEOGRAPHY(ST_MAKEPOINT(-114.0719, 51.0447))
) / 1000 AS distance_km
FROM wells_enriched
WHERE distance_km < 10
ORDER BY distance_km;
The Snowflake External Function setup guide walks through every step: Lambda deployment, API Gateway configuration, IAM roles, and Snowflake integration objects. A data engineer can have it running in under an hour.
Pricing and Alternatives
The External Function uses the Township Canada Batch API. Pricing scales with monthly conversion volume:
| Monthly Rows Converted | API Tier | Price |
|---|---|---|
| Up to 1,000 | Build | $40/mo |
| Up to 10,000 | Scale | $200/mo |
| Up to 100,000 | Enterprise | $1,000/mo |
For comparison, SCADALink — a legacy desktop tool used by some oil and gas companies for DLS conversion — charges $1,200 per seat per year with no Snowflake integration and no batch API. Township Canada's Scale tier covers 10,000 conversions per month at $200/mo, and the data never leaves your warehouse.
For teams not yet on Snowflake, the same conversion capability is available through the Batch API for direct integration, or the web-based batch converter for ad hoc work.
Get Started
- Get a Batch API key from the API portal — starts at $40/month
- Follow the setup guide at the Snowflake External Function guide — covers Lambda, API Gateway, IAM, and Snowflake configuration
- Test it with
SELECT TOWNSHIP_CONVERT('NW-36-42-3-W5')and see coordinates come back in your Snowflake worksheet
For a deeper walkthrough with scheduling and advanced SQL patterns, see the Snowflake DLS enrichment blog post. For general information about legal land descriptions in oil and gas, start with the industry overview.