1

I was trying to import data from files provided here http://download.geofabrik.de/europe/france.html specifically http://download.geofabrik.de/europe/france/languedoc-roussillon-latest-free.shp.zip

I'm using OGR2OGR, I ran the command

ogr2ogr append -f SQLite db.sqlite gis_osm_landuse_a_free_1.shp -dsco SPATIALITE=YES

The error I have are

ERROR 1: sqlite3_step() failed: gis_osm_landuse_a_free_1.GEOMETRY violates Geometry constraint [geom-type or SRID not allowed] (19) ERROR 1: ROLLBACK transaction failed: cannot rollback - no transaction is active ERROR 1: Unable to write feature 2026 from layer gis_osm_landuse_a_free_1.

ERROR 1: Terminating translation prematurely after failed translation of layer gis_osm_landuse_a_free_1 (use -skipfailures to skip errors)`

The corresponding spatialite tables are empty so it seems importing failed.

I have searched for solutions and it seems the Geometry column should be made lowercase.

I'm not sure about any solution, since I'm using SHP files. Is there a possible fix?

Note that many other SHP provided in the ZIP file linked above are converted without any issue. This issue happens for several SHP files.

  • Its possible the spatial reference is not recognized. You may have to update spatial references in the DB, so that the SRID is recognized. – enolan Aug 22 '18 at 15:07
  • Probably the infamous polygon/multipolygon thing. Add -nlt PROMOTE_TO_MULTI gdal.org/ogr2ogr.html and have a new trial. I am sure that this question is duplicate of some other. – user30184 Aug 22 '18 at 15:14
2

user30184 was right

The generated db.sqlite must be removed for appends to work.

ogr2ogr -append -f SQLite db.sqlite gis_osm_landuse_a_free_1.shp -nlt PROMOTE_TO_MULTI -dsco SPATIALITE=YES

I had a python script add all .SHP without any other problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.