MerginMaps / geodiff

Library for handling diffs for geospatial data
https://merginmaps.com
MIT License
150 stars 17 forks source link

Empty multipolygon geometry has different encoding after conversion from GPKG to PG #213

Open wonder-sk opened 2 months ago

wonder-sk commented 2 months ago

DB sync was failing on a dataset with some empty multi-polygons when doing doing sanity check after the initial copy from GPKG to PostGIS.

       "old": "R1AAEX5/AAABBgAAAAEAAAABAwAAAAAAAAA="
       "new": "R1AAEX5/AAABBgAAAAAAAAA="

It turns out the original geometry was a multi-polygon with one polygon with zero rings:

01 | 06 00 00 00 | 01 00 00 00 | 01 | 03 00 00 00 | 00 00 00 00
    multipolygon   one child geom      polygon       no rings

And after the import to PostGIS, the geometry was a multi-polygon with no polygons in it:

01 | 06 00 00 00 | 00 00 00 00
    multipolygon   no child geoms

Not sure where/why this conversion happens. A workaround would be to change the representation of empty multi-polygons before doing operations with geodiff.