Il 25/07/2022 16:12, Tudorache, Marian ha scritto:
When I open the QGIS project created with QGIS2.18 I got a message which notify me the project is an old version of QGIS and some conversion was done.

So when I open QGIS 2.18 project something happened with the data and was transformed from LineString to MultiLineString.

Is this normal behaviour for QGIS 3 to convert the geometry type from single part to multiple parts?
Is any method to supress this transformation?


Hi Marian,
AFAIK the QGIS project update process doesn't actually transform any of your data, it only updates the qgs/qgz file.

The different behaviour is probably due to a change in the QGIS API 3 and in the way a Shapefile layer is loaded in QGIS 3.
Basic Shapefile layer shape types [1] are:
- Point
- MultiPoint
- PolyLine
- Polygon

As you can see, there are Point and MultiPoint types, but only PolyLine and Polygon types and not also MultiPolyLine and MultiPolygon types.

In fact, the Shapefile format treats the PolyLine and the Polygon shape types as layers that can contain both (multi-part) geometries with only 1 part and (multi-part) geometries with 2 or more parts. They are actually multi-part layer types.

With QGIS 2.18, a feature geometry with only 1 part in a PolyLine shape type Shapefile layer was considered as a LineString WKT geometry type, while a feature geometry with 2 or more parts in the same layer was considered as a MultiLineString WKT geometry type. Thus, you needed to correctly use asPolyline() or asMultiPolyline() for features geometries in the same PolyLine shape type Shapefile layer depending on the actual feature geometry type.

With QGIS 3, both the feature geometry with only 1 part and the feature geometry with 2 or more parts in a PolyLine shape type Shapefile layer are considered as MultiLineString WKT geometry type. Thus, you can always use asMultiPolyline() for all the geometries in the same PolyLine shape type Shapefile layer.

Best regards.

Andrea

[1] https://www.esri.com/content/dam/esrisites/sitecore-archive/Files/Pdfs/library/whitepapers/pdfs/shapefile.pdf

_______________________________________________
Qgis-user mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to