Add gdal vector collect, gdal vector dissolve
Adds gdal vector collect, an opposite operation to explode-collections. The --group-by option is used to control which features get combined.
Also adds gdal vector dissolve, which performs UnaryUnion on individual features. I think the name "Union" can be confusing (easily mistaken for https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/union.htm)
On the other hand, while "dissolve" captures the behavior for polygon and maybe point inputs, I don't think it's a good description of how lines are handled. (They're noded, but not combined.) I don't know if "dissolve" should apply GEOSLineMerge (https://postgis.net/docs/ST_LineMerge.html) to the outputs of UnaryUnion (thus "dissolving" the linestrings), or if I should just rename the operation to gdal vector unary-union or gdal vector union.
coverage: 71.359% (-0.001%) from 71.36% when pulling 2b5fe2e0d6e2a57b9dafdd55d3f36f08ccc6ec85 on dbaston:collect-dissolve into ea75dfb98cb6a6fe27d826f840178e8e6b6fe626 on OSGeo:master.
I don't know if "dissolve" should apply
GEOSLineMerge(https://postgis.net/docs/ST_LineMerge.html) to the outputs ofUnaryUnion(thus "dissolving" the linestrings)
That would probably be reasonable. Looking at QGIS dissolve algorithms in https://github.com/qgis/QGIS/blob/0ceeea4a5de28b3644392b7f0b10be220419ee5f/src/analysis/processing/qgsalgorithmdissolve.cpp#L281 , it calls QgsGeometry::mergeLines(), which I assume must do something similar to GEOSLineMerge, if the output of the unary union is linear
I don't especially like GEOS' approach of silently dropping non-linear geometries, so either GDAL will need to do some careful filtering of what it provides to GEOSLineMerge, or I'll need to expose a new LineMerge in GEOS that doesn't have that behavior.
The GDAL project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 28 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
-
that all unit tests are passing
-
that all comments by reviewers have been addressed
-
that there is enough information for reviewers, in particular link to any issues which this pull request fixes
-
that you have written unit tests where possible In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this pull request. If there is no further activity on this pull request, it will be closed in 2 weeks.