Skip to content

fix: Handle EPSG:4326 projection with missing units - #473

Merged
kylebarron merged 2 commits into
mainfrom
kyle/epsg-4326
Apr 24, 2026
Merged

kylebarron merged 2 commits into
mainfrom
kyle/epsg-4326

Conversation

@kylebarron

@kylebarron kylebarron commented Apr 24, 2026 •

Copy link
Copy Markdown
Member

When rendering

https://cngsandbox.org/storage/datasets/d425d937-5a79-44f2-8c9c-8872d7dbafec/converted/Annual_NLCD_LndCov_2023_CU_C1V1.tif

there's a console error:

Uncaught (in promise) Error: Unsupported CRS units: unknown when computing metersPerUnit.
    at metersPerUnit (meters-per-unit.ts:51:9)
    at generateTileMatrixSet (tile-matrix-set.ts:112:15)
    at COGLayer._parseGeoTIFF (cog-layer.ts:202:17)

This is because the parsed WKT object is:

{
    "projName": "longlat",
    "name": "WGS 84",
    "srsCode": "WGS 84",
    "ellps": "WGS 84",
    "a": 6378137,
    "rf": 298.257223563,
    "axis": "neu",
    "units": "unknown",
    "to_meter": null,
    "title": "EPSG:4326"
}

and units: unknown means that we error when computing metersPerPixel

To fix this, we hard-code that projname: longlat maps to units: degree

@github-actions github-actions Bot added the fix label Apr 24, 2026
@kylebarron
kylebarron enabled auto-merge (squash) April 24, 2026 19:41
@kylebarron
kylebarron merged commit af671b5 into main Apr 24, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/epsg-4326 branch April 24, 2026 19:43
@ds-release-bot ds-release-bot Bot mentioned this pull request Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant