3

I have a polygon layer I want to explode into single lines. I preferably wish to do so in spatialite since I work almost exclusively in QGIS DB-manager. No matter which function I use the number of features stays the same:

ST_DissolveSegments(st_boundary(geometry))

ST_LinesCutAtNodes(st_boundary(geometry),st_dissolvepoints(geometry))

Now there is also that concept of ElementaryGeometries which is spatialite specific and does not seem to be implemented in geopackage or QGIS virtual layers (please correct me if I am wrong here). Also there's this answer that I honestly fail to follow due to sparse documentation as well as on whether this is implemented in QGIS' DB-manager environment or not.

I know there's a bunch of native tools that do the job but I'd really love to keep my workflow streamlined and avoid intermediate result layer as much as possible.

maxwhere
  • 1,156
  • 6
  • 16
  • 2
    I don't think it is easily possible (yet), and you may have to rely on using a geoprocessing tool instead of a virtual layer. There is a way to achieve it using recursive queries, have a look at this post – JGH Dec 10 '21 at 21:49
  • TY, bookmarked. Morbidly fascinating. Successfully tested, adoption for exploding lines pending. – maxwhere Dec 10 '21 at 22:13
  • Maybe the ST_Dump() function helps https://postgis.net/docs/ST_Dump.html – jpinilla Dec 11 '21 at 09:49
  • 1
    ST_Dump does not work for spatialite/Virtual Layer at this point. I agree, CTE/recursive queries seem to be the only way forward for now. See https://gis.stackexchange.com/a/341570/98784 for another example – she_weeds Dec 14 '21 at 01:10

0 Answers0