2

I have a spatialite table with more than 1100 Polygons. The geometry type in that table is multipolygon. There are only some real Multipolygons inside and I need only polygons. How can I find the multiparts? How can I split the multiparts? Also are there some polygons without geometry. What is the way to identify them? I want to do that work in the database but could do it also in QGIS.

1 Answer 1

5

In SpatiaLite, you can use the function ElementaryGeometries such as the following code :

SELECT ElementaryGeometries('multipoly', 'geom', 'singlepoly','gid','fid') as geom
FROM multipoly

This function create a new table singlepoly where each multipolygon of the table multipoly is converted to a simple polygon. For example, I had one feature. For example, I had a multi-polygon with 4 features. On output, I get a table with 4 rows.

In QGIS, you can use the following tool : Vector > Geometry tools > Multipart to Singleparts.

4
  • 1
    SpatiaLite does have a function for that and it is called ElementaryGeometries gaia-gis.it/stored-procs-win-test/spatialite-sql-latest.html.
    – user30184
    Feb 14, 2020 at 10:30
  • Thank you, you're right! I edited my answer. Feb 14, 2020 at 10:53
  • 1
    Thanks a lot. That helps. There are some additional questions: How could I identify and select the rows with multiparts? How coul I copy/save the polygons from the table with geom MULTIPOLYGON into a table with geom POLYGON?
    – Torsten
    Feb 14, 2020 at 13:04
  • You-re welcome! You can accept my answer if it helped you! I advise you to open a new post to ask your question. Feb 14, 2020 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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