I'm getting some geometries via intersecting lines by polygons (somewhat blindly - I don't really know if intersection exists and actually I don't need to know) using python and QGIS API:
some_line.intersection(some_polygon). To my mind I may get several types of geometry (is the following list correct?):
- None (if there is no intersection).
- Geometry collections (when there are several points and/or lines)
But the geometry I need in the end is a Linestring (Polyline) or several Linestrings (not MultilineStrings). I can identify geometry type using
wkbType(). ( It returns integer, am I right that this integer corresponds to this order?)
The question is how can I split MultilineStrings and Geometry collections and get the parts they are consist of (preferably using QGIS API)? I wasn't able to find such function in QGIS API, maybe just missed it? There is also
GetGeometryRef() function in OGR that I believe could help me, but I can't figure out how to implement it in my case.