koordinates / kart

Distributed version-control for geospatial and tabular data
https://kartproject.org
Other
515 stars 39 forks source link

Fix some non-homogenous CRS conflicts #975

Closed craigds closed 4 months ago

craigds commented 4 months ago

Description

Fix some non-homogenous CRS conflicts

If you import a file whose CRS contains a datum name formatted with spaces or parentheses, and you convert to COPC during import, then PDAL will 'normalise' the CRS WKT.

(It is not possible to create such a file using PDAL because it normalises CRS during write, so the test file here was manually altered using laspy.)

Later imports using --update-existing will fail because Kart checks the tile's CRS (before PDAL normalisation) against the existing dataset name (after PDAL normalisation), and fails because they were different.

THis change fixes the issue by comparing the two CRSes using GDAL's OSRSpatialReference.IsSame() method, rather than a direct string comparison. This is lax enough to return True when the WKT varies only slightly.

Another option was to normalise all WKT during import by running it through ExportToWkt() but I opted not to do this because:

Related links:

Fixes #973.

Checklist: