[Qgis-user] Merge Selected Features creates 2 parts

Nicolas Cadieux njacadieux.gitlab at gmail.com
Wed Aug 19 19:00:38 PDT 2020


See below...

Nicolas Cadieux
Ça va bien aller!

> Le 19 août 2020 à 21:49, Stewart Holt <stewartbholt at gmail.com> a écrit :
> 
> 
> I am using QGIS 3.14.1-Pi on Windows 10. I wanted to merge 107 line features into one feature. The features are in a Line (MultiLineString) shapefile. I selected the layer, put it in edit mode, clicked Invert Selection, and then clicked "Merge Selected Features" from the advanced digitizing toolbar. The feature count dropped to one as expected but I noticed something unexpected. Before discovering that the line segments did not have to be oriented in the same direction to be merged, I had added an additional triangle symbol at the end of the line to help with flipping them. After the merge there were 2 triangles remaining. One at the end and one somewhere in the middle but only one line feature. Using shpdump from shapelib, I verified that there was one shape but with 2 parts. The original file had 107 features, each with only one part. In an attempt to outsmart it I split the parts into separate features and then merged them but the result was the same.

I may be wrong but if I recall, if a merge cannot create a single object, it will create a multipart object.  Dissolve would “fuse” two single part lines into one single part object.  I may be wrong here.  If you dump the shape in a WKT, you will see what is happening.  To my knowledge, there is no limite to the complexity of a shape.
> 
> I wondered if there was a limit on the number of points in a feature and that was the cause for the split. I did a wc count on the output of shpdump and got 33207. The point count would be only slightly less than this number and would be over the size of a signed, 16 bit integer, but I see no 2 byte integers in the shapefile format. Even the file type is 4 bytes. I just did a test with only several line features and got the same result.
> 
> Would you consider the merge forming 2 parts a bug? I think it would be preferable for it to not do that even though for many purposes, it might not cause a problem. I did not find an open issue with a search on GitHub.
> 

> Secondary question: Is there any tools in QGIS which list the contents of the shapefile.shp like shpdump can? There are many aspects of a shapefile such as whether it M and Z values, etc and it is useful to get an understanding of the data.

The file properties (layer properties) will give you that information.
> 
> Thanks,
> 
> Stewart Holt
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200819/70acefd0/attachment.html>


More information about the Qgis-user mailing list