-
Notifications
You must be signed in to change notification settings - Fork 19
feat(geo): implement support for all raster topo map series projections BM-1160 #3480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(geo): implement support for all raster topo map series projections BM-1160 #3480
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
6e172ae
Auto-generating
|
| export class UtmZone { |
I've refactored the ProjectionLoader class to support special handling for UTM Zone codes. I've also moves the ProjJSON fetching logic into a standalone function so that I can use it in my unit tests:
| static async fetchProjJson(code: number): Promise<PROJJSONDefinition> { |
I've added a unit test that compares our generated ProjJSON objects against those fetched from spatialreference.org. It is a heavy test, so not sure whether we want to keep it. I added it just to really be sure the numbers were right for all 60 zones:
| it('should generate a ProjJSON for each UTM Zone EPSG code that matches the spatialreference.org ProjJSON', async () => { |
Open to all feedback, let me know.
Update: Action items from feedback
Action Items
|
# [8.8.0](v8.7.0...v8.8.0) (2025-09-07) ### Bug Fixes * add required permissions for release please github action ([#3497](#3497)) ([a6155c9](a6155c9)) * **cli-vector:** Fix the tmp path of download layers and add try catch. BM-1352 ([#3494](#3494)) ([3769175](3769175)) * intermittent unit tests ([#3503](#3503)) ([1e942af](1e942af)) * stop using GITHUB_TOKEN for release-please ([#3495](#3495)) ([198cb29](198cb29)) ### Features * **cli-raster:** Fetch chart imagery metadata from backup location.BM-1345 ([#3492](#3492)) ([2b42fa7](2b42fa7)) * **cli-raster:** New cli to standardise charts map. BM-1338 ([#3483](#3483)) ([35b7854](35b7854)) * **geo:** implement support for all raster topo map series projections BM-1160 ([#3480](#3480)) ([8652578](8652578)) * **geo:** support tile matrixes that are not square ([#3484](#3484)) ([7720d02](7720d02)) * **lambda-tiler:** support one band uint16 lerc tiffs ([#3489](#3489)) ([906d016](906d016)) * **landing:** quick change cycles through more basemaps BM-1293 ([#3493](#3493)) ([4bfba36](4bfba36))
### Motivation Attempting to process imagery with a projection code of `4326` guarantees a runtime error. In a recent [piece of work], we modernised our processes for parsing EPSG codes and projections. With that work, we neglected to re-ensure support for the WGS84 geographic coordinate system (`EPSG:4326`). This work re-introduces that support via our new strategy. [piece of work]: #3480 [Slack thread](https://linz.slack.com/archives/C5TCTQUJG/p1757376768654719) ### Modifications - **packages/geo** - `projection.ts` - Added a key-value pair for WGS84 (`EPSG:4326`) to the `Projections` map. ### Verification - **packages/geo** - `proj.json.test.ts` - Added a new test to ensure that all supported EPSG codes have an `Epsg` and `Projection` instance. - Updated the existing tests to use each respective class's `get` function, rather than the `tryGet` function, to allow asserting based on whether the `get` function throws an error.
# [8.9.0](v8.7.0...v8.9.0) (2025-09-09) ### Bug Fixes * add required permissions for release please github action ([#3497](#3497)) ([a6155c9](a6155c9)) * **cli-vector:** Fix the tmp path of download layers and add try catch. BM-1352 ([#3494](#3494)) ([3769175](3769175)) * **geo:** ensure all supported epsg codes have a projection ([#3508](#3508)) ([23a9243](23a9243)) * intermittent unit tests ([#3503](#3503)) ([1e942af](1e942af)) * remove release-please from prod deploy ([#3506](#3506)) ([05b6f95](05b6f95)) * stop using GITHUB_TOKEN for release-please ([#3495](#3495)) ([198cb29](198cb29)) ### Features * **cli-raster:** Fetch chart imagery metadata from backup location.BM-1345 ([#3492](#3492)) ([2b42fa7](2b42fa7)) * **cli-raster:** New cli to standardise charts map. BM-1338 ([#3483](#3483)) ([35b7854](35b7854)) * **geo:** implement support for all raster topo map series projections BM-1160 ([#3480](#3480)) ([8652578](8652578)) * **geo:** support tile matrixes that are not square ([#3484](#3484)) ([7720d02](7720d02)) * **lambda-tiler:** support one band uint16 lerc tiffs ([#3489](#3489)) ([906d016](906d016)) * **landing:** quick change cycles through more basemaps BM-1293 ([#3493](#3493)) ([4bfba36](4bfba36))
### Motivation In a [recent piece of work], we added the remaining _GeoTag to EPSG_ mappings necessary to process all of the Topo Raster map series collections (ANT, NZOI, PI). In the work, we mistakenly matched the following GeoTags to the wrong EPSG: | GeoTag | EPSG | | - | - | | Chatham Islands Transverse Mercator 2000 | 2193 | | New Zealand Transverse Mercator 2000 | 3793 | [recent piece of work]: #3480 This PR corrects the mistake: | GeoTag | EPSG | | - | - | | New Zealand Transverse Mercator 2000 | 2193 | | Chatham Islands Transverse Mercator 2000 | 3793 | ### Modifications - **packages/cli-raster** - `cogify/topo/extract.ts` - Adjusted the _GeoTag to EPSG_ mappings. ### Verification I've run the following `topo` CLI commands to ensure the generated directories and STAC Items contain the expected map sheets: - **New Zealand (NZ)** - **NZTopo250_GeoTif_Gridless** ``` node packages/cli-raster/build/bin.js topo s3://linz-topographic-upload/topographic/TopoReleaseArchive/NZTopo250_GeoTif_Gridless/ --target ./tmp/target/nz-topo250/ --map-series topo250 --output ./tmp/output/nz-topo250/ ``` - **NZTopo50_GeoTif_Gridless** ``` node packages/cli-raster/build/bin.js topo s3://linz-topographic-upload/topographic/TopoReleaseArchive/NZTopo50_GeoTif_Gridless/ --target ./tmp/target/nz-topo50/ --map-series topo50 --output ./tmp/output/nz-topo50/
This work also fulfills BM-1337.
Motivation
In the near future, we want to process the Antarctic, Offshore Islands, and Pacific region Topo Raster map sheet collections and import them into Basemaps. To enable this, we need to support all of the projections required for each map sheet collection:
Antarctic (ANT)
New Zealand Offshore Islands (NZOI)
Pacific Islands (PI)
To support a projection requires several elements (either statically-defined or initialised at runtime):
Epsg)ProjJSON)TileMatrixSet)Furthermore, to process a map sheet collection via our cli-raster package's
topocommand requires:A projected citation geokey mapping to EPSG code. For example:
An EPSG code & map series mapping to a slug. For example:
Modifications
packages/cli-raster
cli
topoCLI command to support topo25 map series collections.cogify/topo
Added geotag to
EPSGmappings to theGeotagToEpsgCodedata structure. Updated the matching logic to check against all geotag citations instead of short-circuiting early.Updated the
Slugsdata structure to allow us to describe slugs based on a given EPSG code and map series name (e.g. 'topo25'). This allows us to assign distinct slugs for different map series collections that resolve the same EPSG code.Added
EPSG& map series to slug mappings to theSlugsdata structure.You can find a full breakdown of the mappings here (Jira).
packages/geo
We've graduated from using
WKTs. We now useProjJSONsfor initialisingProjectioninstances and for generatingTileMatrixSetinstances at runtime.Added a proj folder containing projection
ProjJSONdefinitions for all of the expected map series projections, organised by collection:ant,nz, andnzoi.Added a
UTMZoneclass containing interpolation logic for generatingPROJJSONDefintionobjects for UTM Zone codes.Modified the constructor of the
Epsgclass to support theEPSGTextMaplookup performed when initialising a newTileMatrixSetinstance, specifically forEPSGinstances initialised at runtime.tms
JSONfile, it now returns a newTileMatrixSetinstance at runtime. We use this function as part oftopoCLI command for generating tile matrices at runtime.packages/shared
scripts
Updated the
debug.tile.matrix.tsscript to resolve compilation errors.Verification
The following is an exhaustive list of the
topoCLI commands required to process all of the Topo Raster map sheet collections:Antarctic (ANT)
ANTTopo50_GeoTif_Gridless
New Zealand Offshore Islands (NZOI)
NZOITopo25_GeoTif_Gridless
NZOITopo50_GeoTif_Gridless
New Zealand (NZ)
NZTopo250_GeoTif_Gridless
NZTopo50_GeoTif_Gridless
Pacific Islands (PI)
PITopo25_GeoTif_Gridless
PITopo50_GeoTif_Gridless
End-to-End Argo Test
I've conducted an end-to-end Argo test for the ANTTopo50 map series collection: