spatialite v.2.3.1 2.5D append failure
|Reported by:||esseffe||Owned by:||Even Rouault|
Andrea Peri (Regione Toscana) have detected an issue related to the recently updated SpatiaLite driver: ogr2ogr sometimes fails (constraint violation) while appending further data into an already existing table.
I've performed some debugging, and I've discovered that this issue only happens when input data are 2.5D and the supporting libspatialite is v.2.3.1 (legacy).
- v.2.3.1 (and any previous version) simply supports
2D [XY] geometries
- the OGR/spatialite driver checks the library version,
and unconditionally forces 2D casting while creating
a new table
- but the same version check isn't performed when -append
is specified and the table already exists: so the
subsequent attempt to insert any 2.5D [XYZ] geometry
into a 2D table will then cause a constraint violation
the attached patch (svn-diff) resolves this issue.
the same patch removes the "-lco FORCE_2D=yes/no" option, basically for the same reason: this will only work for create, not for append; and this is intrinsically not safe and confusing.