-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
"Split Features" and "Cut with Selected Polgyons" turns polygons into linestrings (Geopackage, GeoJSON) #58
Comments
Workaround: for the time being, corrupt Geopackage files (mixing multipolygons and geometry collections of linestrings) can be repaired with the sf package in R. Assuming the path to your geofpackage file is stored in
See also this on StackOverflow: https://stackoverflow.com/questions/57677412/sf-how-to-get-back-to-multipolygon-from-geometrycollection |
@aourednik interesting problem, good that you found a workaround. I did only test with Shape and PostGIS where in both cases the data provider enforces the geometry type. What do you suggest how the tool should behave?
Could you share example data? |
@bstroebl Thx for reply. An example of a data containing one featur of "geometry collection of linestrings" type (instead of a multipolygon) resulting from cutting is in this commit: https://raw.githubusercontent.com/aourednik/historical-basemaps/044c9fa854d23087fe5f51cd8481ba17a13ccbf8/geojson/world_bc100.geojson The best solution for my usecase would be to enforce the geometry type in the algorithm itself, i.e., scan the layer for geometry types and use the most frequent one when generating the new, cut, features. This could happen silently or with a warning like "Geometry type of resulting features was determined from the most frequent geometry type in the layer". I note that your tool does a much better job at keeping geometry types coherent than the preinstalled digitizing tools of QGIS 3. I have the feeling that many QGIS' own and package algorithms remain Shape-oriented, while the software seems to promote the newer GeoPackage format (an excellent step in all other reagrads, since Shape does horrible things to Unicode string fields, among other inconveniences) |
The question is why the cutting results in a linestring. I guess it is because the two polygons are (at least partly) identical. To verify I would need both input layers. If the result of an operation is a linestring one cannot make it a polygon. I can only see the three possible solutions I noted above. |
"Split Features" and "Cut with Selected Polgyons" functions often turn polygons into linestrings.
Geometry should be strictly enforced to never generate a feature of another kind than the kind of the original (split or cut polygon).
Both GeoPackage and GeoJSON do support multiple geometry types (a mixture of multiplogons and linestrings in a single file and layer), but this does terrible things in other GIS software (when exporting file from QGIS and opening it with something else)
The text was updated successfully, but these errors were encountered: