Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db manager fails to import all features from shapefile to spatialite #15563

Closed
qgib opened this issue Aug 27, 2012 · 5 comments
Closed

db manager fails to import all features from shapefile to spatialite #15563

qgib opened this issue Aug 27, 2012 · 5 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Aug 27, 2012

Author Name: Etienne Tourigny (@etiennesky)
Original Redmine Issue: 6257
Affected QGIS version: master
Redmine category:data_provider/spatialite
Assignee: Giuseppe Sucameli


when dropping layer from file manager to spatialite file in browser, not all features are copied. This happens in both 1.8 and master

However, import is fine when using qspatialite plugin.

The error given when using 1.8 is

Failed to import some layers!

clas_226_67_20100724_pol: Feature write errors:
Creation error for features from #10259 to #10340. Provider errors was: 
SQLite error: constraint failed
SQL: INSERT INTO "clas_226_67_20100724_pol"("pk","geomm","sprarea","sprperimet","sprclasse") VALUES (NULL,GeomFromWKB(?, 4326),?,?,?)
Only 200 of 282 features written.

in master:

Failed to import some layers!

clas_226_67_20100724_pol: Feature write errors:
Creation error for features from #0 to #0. Provider errors was: 
SQLite error: constraint failed
SQL: INSERT INTO "clas_226_67_20100724_pol"("geomm","sprarea","sprperimet","sprclasse") VALUES (GeomFromWKB(?, 4326),?,?,?)
Only 200 of 282 features written.

ogrinfo on the file:

$ ogrinfo -so clas_226_67_20100724_pol.shp clas_226_67_20100724_pol
INFO: Open of `clas_226_67_20100724_pol.shp'
      using driver `ESRI Shapefile' successful.

Layer name: clas_226_67_20100724_pol
Geometry: Polygon
Feature Count: 282
Extent: (687536.000000, 8806300.000000) - (886580.000000, 8975017.000000)
Layer SRS WKT:
(unknown)
SPRAREA: Real (20.4)
SPRPERIMET: Real (20.4)
SPRCLASSE: String (32.0)

I get a similar error with a larger file

Failed to import some layers!

clas_226_67_20101012_pol: Feature write errors:
Creation error for features from #13659 to #13857. Provider errors was: 
SQLite error: constraint failed
SQL: INSERT INTO "clas_226_67_20101012_pol"("pk","geomm","sprarea","sprperimet","sprclasse") VALUES (NULL,GeomFromWKB(?, 4326),?,?,?)
Creation error for features from #13858 to #13987. Provider errors was: 
SQLite error: constraint failed
SQL: INSERT INTO "clas_226_67_20101012_pol"("pk","geomm","sprarea","sprperimet","sprclasse") VALUES (NULL,GeomFromWKB(?, 4326),?,?,?)
Creation error for features from #13988 to #4148. Provider errors was: 
SQLite error: constraint failed
SQL: INSERT INTO "clas_226_67_20101012_pol"("pk","geomm","sprarea","sprperimet","sprclasse") VALUES (NULL,GeomFromWKB(?, 4326),?,?,?)
Only 3600 of 4149 features written.


@qgib
Copy link
Contributor Author

qgib commented Aug 28, 2012

Author Name: Giovanni Manghi (@gioman)


  • operating_system was changed from linux to
  • assigned_to_id was configured as Giuseppe Sucameli

@qgib
Copy link
Contributor Author

qgib commented Sep 4, 2012

Author Name: Paolo Cavallini (@pcav)


  • fixed_version_id was configured as Version 2.0.0

@qgib
Copy link
Contributor Author

qgib commented Nov 29, 2012

Author Name: Giuseppe Sucameli (@brushtyler)


The SL provider doesn't convert geometries to multipart when needed (i.e. when the layer has a multipart type).

Somehow related to #15140 because the problem usually occurs importing shapefiles.


  • category_id was changed from DB Manager to Data Provider/SpatiaLite
  • status_id was changed from Open to In Progress

@qgib
Copy link
Contributor Author

qgib commented Nov 29, 2012

Author Name: Giuseppe Sucameli (@brushtyler)


Giuseppe Sucameli wrote:

The SL provider doesn't convert geometries to multipart when needed (i.e. when the layer has a multipart type).

The @AddGeometryColumn@ spatialite function adds triggers to check the geometry type and srid of new/changed geometries but the constraint fails trying to add a singlepart geometry to a spatial table with a multipart geometry type.

The @ST_Multi@ function is available for SL >= 2.4.0, so we have to handle it to avoid to get a "no such function" error working on older DBs.

@qgib
Copy link
Contributor Author

qgib commented Dec 5, 2012

Author Name: Giuseppe Sucameli (@brushtyler)


Fixed in changeset "1bde6c58df3ed73e200e98809ab508e6d6b62d38".


  • status_id was changed from In Progress to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers labels May 24, 2019
@qgib qgib added this to the Version 2.0.0 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers
Projects
None yet
Development

No branches or pull requests

1 participant