0

I have followed some examples for dissolving polygons in Spatialite and successfully created my simpler polygons:

SELECT 
  "col1"
  sum("total") AS "total",
  st_union("GEOMETRY") AS "GEOMETRY"
FROM "table"
GROUP BY "col1";

I can preview these new shapes in Spatialite (Map Preview, Check Geometries), but they're not showing up as 'geometry' tables, with the little world icon, and I can't view them in QGIS.

I've seen examples that say I need to use something like this:

SELECT AddGeometryColumn('test_geom', 'the_geom',
  4326, 'POINT', 'XY');

Can I convert the existing "geometry" column without adding a "geometry1" column?

Also, some of merged shapes are polygons and some are multipolygons due to minor errors in the original file coverage. I hope to edit the errors in the dissolve in QGIS, what new geometry type is best use for the table?

  • You have geometry column. What you do not have is a new row in the "geometry_columns" table. – user30184 Dec 5 '17 at 16:36
  • What command adds that? – user15741 Dec 5 '17 at 16:38
1

The command I needed was:

RecoverGeometryColumn

And it was originally failing because I had geometries of types polygon and multipolygon in the same table due to slivers and holes created by the union. No error message appears when there are multiple types, just no geometry metadata is created. Switching to Geometry as type allowed Recover to work, but then QGIS wouldn't display both types of geometries, so the full fix was to remove all slivers, repeat the union, then successfully set the geometry column.

Through the GUI, right-clicking on the geometry column gives the option to check geometry, showing types and SRIDs data in the column. Also, right-clicking provides the option to Recover geometry column, which does the same thing as the SQL command.

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.