4

I am trying to import an sqlite file to the QGIS DB Manager with default import settings. While the layer displays fine in the graphical interface, the DB Manager only partially loads it, stopping after 2K of 500K rows, citing that the table "violates Geometry constraint [geom-type or SRID not allowed]". What am I doing wrong?

  • 1
    Probably nothing. I would assume that the error message is true and the SQLite layer really has a mixture of different geometry types or SRIDs. The latter is unlikely IMHO. Open the sqlite file with Spatialite-gui and run the "Check geometries" utility from the right click menu once the geometry attribute of the table is selected. – user30184 Mar 14 '16 at 20:06
  • About 1% of the geometries are indeed multipolygon whereas the rest are of "polygon" type. Can I simplify the polygons to a centroid (that's all I need) through spatialite-gui ? QGIS crashes continuously when i try to extract the centroid through the regular interface, it think the database is just too massive. – Dealec Mar 14 '16 at 20:50
  • Naturally, update your_table set geometry=ST_Centroid(geometry); or safer CREATE TABLE centroids AS SELECT ST_Centroid(geometry) as geometry, attribute_1, attribute_2 ... FROM your_table. You must also register the geometry column of the new table before QGIS finds it. Spatialite-gui has tools for that. – user30184 Mar 14 '16 at 21:00

Your Answer

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

Browse other questions tagged or ask your own question.