Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#4288 closed defect (fixed)

spatialite v.2.3.1 2.5D append failure

Reported by: esseffe Owned by: Even Rouault
Priority: normal Milestone: 1.9.0
Component: OGR_SF Version: svn-trunk
Severity: major Keywords: spatialite
Cc: even.rouault@…, a.furieri@…

Description

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.

Attachments (1)

splite-append-231-patch.zip (1.8 KB ) - added by esseffe 11 years ago.
svn-diff proposed patch

Download all attachments as: .zip

Change History (3)

by esseffe, 11 years ago

Attachment: splite-append-231-patch.zip added

svn-diff proposed patch

comment:1 by Even Rouault, 11 years ago

Cc: a.furieri@… added
Milestone: 1.9.0
Resolution: fixed
Status: newclosed

r23237 /trunk/gdal/ogr/ogrsf_frmts/sqlite/ (drv_sqlite.html ogr_sqlite.h ogrsqlitedatasource.cpp): Spatialite: add fallback to 2D mode in append use case with spatialite < 2.3.1. Remove FORCE_2D creation option that was added in r23133 (#4288)

CC'ing Sandro so he can express his opinion on the removal of the FORCE_2D option. I was not too sure if it was adequate or not to remove it, but I failed to see a strong reason why someone would want to stick to 2D only if 2.5D is possible, so I kept that part of your patch.

comment:2 by esseffe, 11 years ago

Hi Even,

Yes, I fully agree with myself ;-)

"esseffe" is my nickname (= SF = Sandro Furieri)

thanks for quickly committing my suggested patch

bye Sandro

Note: See TracTickets for help on using tickets.