<< All versions
Skill v1.0.0
currentAutomated scan100/100kendrick-oppong/geoskills/crs-and-reprojection
──Details
PublishedOctober 25, 2026 at 01:48 AM
Content Hashsha256:8bf4c610f1ac4419...
Git SHAfe4762133b94
──Files
Files (1 file, 4.5 KB)
SKILL.md4.5 KBactive
SKILL.md · 77 lines · 4.5 KB
version: "1.0.0" name: crs-and-reprojection description: Use when a task involves coordinate reference systems, EPSG codes, datum mismatches, unit confusion (degrees vs meters), "why are my points offset", axis-order bugs, or deciding whether/how to reproject vector or raster data.
CRS & Reprojection
When to use this skill
- "My points are in the ocean / offset by a few hundred meters"
- "What EPSG code should I use for X"
- Any mention of
proj4,pyproj,ST_Transform,.prj, WKT2, datum, or "axis order" - Merging two datasets that were "definitely in the same place" but don't align
Core concepts
CRS has three independent axes of confusion — check all three before touching code:
- Datum (WGS84 vs NAD83 vs ETRS89 v's local datum) — a few meters to tens of meters of drift if mismatched.
- Projection (geographic lat/lon vs projected meters) — mixing degrees and meters silently produces "wrong by 100x" bugs.
- Axis order — EPSG:4326 is officially (lat, lon), but GeoJSON, most web tooling, and PostGIS geometry input use (lon, lat). This is the single most common source of "flipped" data.
Default recommendations (principal-level defaults, not dogma):
| Use case | CRS | Why | |
|---|---|---|---|
| Storage / interchange (GeoJSON, APIs) | EPSG:4326 (WGS84) | Universal interop; required by GeoJSON spec | |
| Web map tiles / display | EPSG:3857 (Web Mercator) | What every web map engine renders in | |
| Distance/area math, buffering, routing | A local projected CRS (UTM zone, or a national grid) | 4326 degrees are not equal-distance; 3857 distorts area badly at high latitude | |
| Global equal-area analysis | EPSG:6933 or Equal Earth | Avoids Mercator's polar area inflation | |
| High-precision surveying/cadastral | National datum (e.g. EPSG:2193 NZTM, EPSG:27700 OSGB) | Sub-meter accuracy requirements |
Rule of thumb: never do distance, area, or buffer math directly on EPSG:4326 coordinates. Reproject to a metric CRS first, compute, then reproject back if needed for storage.
Checklist
- [ ] Identify the CRS of every input independently — never assume; check
.prj, WKT, or metadata - [ ] Confirm axis order matches what the library expects (GeoJSON = lon,lat; many GIS tools display lat,lon)
- [ ] If datum differs (not just projection), use a full datum transform (
pyproj.Transformer, PostGISST_Transformwith correct SRID, not a naive re-tag) - [ ] Never just "relabel" an SRID on unprojected data — that moves the data without transforming it
- [ ] For area/distance/buffer operations, reproject to an appropriate equal-area or equidistant projected CRS first
- [ ] For a country/region-scale app, pick and hardcode one UTM zone or national grid rather than reprojecting per-request
- [ ] Round-trip test: reproject A→B→A and confirm sub-millimeter drift only
Common pitfalls
- Flipped coordinates: passing
(lat, lon)where(lon, lat)is expected (or vice versa) — symptom is points in the wrong hemisphere or ocean. Fix: explicitly assert axis order at every system boundary (API in/out, DB read/write, frontend map init). - "It's close enough" datum skipping: NAD27→NAD83 or local datum→WGS84 differences look small on a low zoom map but break precision work (parcels, construction, autonomous navigation).
- Buffering in degrees:
ST_Buffer(geom, 0.01)on EPSG:4326 gives wildly different real-world distances near the poles vs the equator. - Web Mercator area math: computing "area" in EPSG:3857 units — Mercator area distortion grows without bound toward the poles.
- Silent SRID = 0 / missing SRID: geometries inserted without an SRID behave inconsistently across PostGIS versions/functions.
Reference snippets
python
from pyproj import Transformertransformer = Transformer.from_crs("EPSG:4326", "EPSG:32633", always_xy=True) # WGS84 -> UTM 33Nx, y = transformer.transform(lon, lat) # always_xy=True enforces (lon, lat) order
sql
-- PostGIS: reproject before area calcSELECT ST_Area(ST_Transform(geom, 32633)) AS area_m2 FROM parcels;
javascript
// proj4js in a browser/Node context (e.g. Angular/Next.js frontend needing a non-Mercator CRS)import proj4 from 'proj4';proj4.defs('EPSG:32633', '+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs');const [x, y] = proj4('EPSG:4326', 'EPSG:32633', [lon, lat]);
Related skills
global-crs-selection— choosing a projection for world/continental-scale displaypostgis-geospatial— SRID handling inside a databasegeodata-qaqc— detecting CRS mismatches as part of intake validation