[Qgis-user] Split features tool behavior

Bernhard Ströbl bernhard.stroebl at jena.de
Wed May 31 23:22:11 PDT 2017


Hi Andreas,

Am 31.05.2017 um 18:02 schrieb Andreas Wicht:
> Hi Bernhard,
>
>>>> I dug deeper and it seems that I can always split the part once. Any
>>>> further
>>>> splitting of any part results in the invalid geometry error.
>>>> https://issues.qgis.org/issues/12799 describes why.
>>>
>>>
>>> Exactly. So when you split the polygon and save the edits you will
>>> have said self-intersection in your data. That's why the second split
>>> will not work (correct behaviour).
>>
>>
>> Still you can save it and have thus an invalid geometry
>
> The correct behaviour was aimed towards the fact, that you can not do
> a second split due to the invalid geometry and not due to being able
> to save the invalid geometry.
>
>>>> Back to what you try to achieve: you could use "Split feature" to create a
>>>> new feature, manipulate what you need, even split this feature again and
>>>> then use "merge feature" with those polygons that should form the
>>>> multipolygon. Your first mail indicates that you are puzzled because you
>>>> get three features if you apply "split features" to a part of a multipart
>>>> polygon (1 = split part1, 2 = split part2, 3 = all the
>>> Split Features is not an option here, because in this example the
>>> island would also be separated from the polygon which is not
>>> necessarily wanted.
>> I do not get, what you mean, anyways you can merge several features into one
>> at anytime.
>
> If you edit a real world dataset this becomes more clear maybe.
> Let it be some kind of administrative structure with a lot of small
> islands (literal islands) for example at the Norwegian coast.
> Therefore one dataset (multipart-feature) contains the polygon on the
> mainland and all the island (literal island) polygons attached to it.
> If you want to split the mainland polygon (see my example data) and
> use "Split Features" you would have to merge all islands again
> afterwards. That is what I mean by "that is not an option here". It's
> possible, but totally impractical.

In my tests only the halves of the part that was split became new 
features, the rest of the mulit-part feature stays multipart, so all the 
islands would stay in the feature and you would only have to merge one 
half with the island multi polygon.

>
>>> Yes, I totally get that. But as I said before, other GIS handle it
>>> more intuitively.
>>> I don't know in detail how they technically do it (closed source).
>>> - ArcGIS's "Cut Polygon" tool
>>> - MapInfo's "Split" tool
>>
>> I do not have access to these packages. Could you describe what they do
>> differently?
>
> For ArcGIS I don't exactly know. It just produces the result which I expect.
> The result is (using my sample data screenshots) 2 features. The right
> features (which was cut off) and the left features (multipart polygon
> of the other half + the part which is in this case a literal island).
> How it exactly determines the correct relations of the parts, I can't
> tell you.

Maybe it depends on the direction the splitting line is drawn? This 
approach, however, would only work if the polygons are following the 
right-hand rule which is not the case for all providers [1].

[1] http://postgis.net/docs/manual-2.3/ST_ForceRHR.html

>
> MapInfo has a more obvious approach. When you split a
> multipart-feature with a line (2 vertices), it will extend the line to
> the boundingbox-boundary, and split the feature with a polygon which
> is constructed by the intersection of the bounding box and the
> (extended) digitized line. Therefore the new feature which is created
> will always be the portion which was covered by that polygon. The
> other half of the feature remains a multipart feature and keeps all
> parts which lie outside that splitting polygon.
> When splitting a multipart polygon by a polyline (more than 2
> vertices) it will always close the polyline automatically and
> therefore construct the splitting polygon.

If I have a bounding box and a splitting line there are two polygons 
possible: one to the left and one to the right of the splitting line. 
How does MapInfo decide which one to use? Or is this a user's choice? 
Maybe it's the same as I assumed for ArcInfo (right-hand rule).

>
>>> I think logically one would have to chain splitting the part and
>>> automatically converting the new part as a separate polygon in one
>>> tool (given the robust automatic identification of the new part).
>>
>>
>> But that is exactly what split feature does if you apply it to a part: It
>> splits the part and adds both "halves" as new features. I would not expect
>> any of the halves becoming a new feature and the other staying a part of the
>> multipart feature arbitrarily. What should I do if the wrong half stays?
>> Therefore for me the workflow is clear: 1) Split features 2) merge the
>> feature that should stay with the multipart feature. 3) Done
>
> The manually merging step is where the errors will be produced, once
> you deal with a complicated layer of some sort.
> That is what I mean as described above. Other GIS make sure the
> correct half stays and I do not have to deal with the merging step.
>
>> BTW: We should agree on common terms; these are the terms QGIS uses AFAIK: a
>> feature is a dataset, i.e. one row in the table; it can either have one
>> geometry or several geometries as spatial representation (or none but that's
>> of no interest here). If it has several geometries it is called a multi-part
>> feature, each individual geometry is called a part then. A polygon is a type
>> of geometry; if it is a multi-part polygon, each part is a polygon in itself
>> (therefore I tried to avoid "polygon" altogether and used "feature" and
>> "part" instead to be clear). An island is a hole in a single polygon, QGIS
>> calls it "ring". In DigitizingTools I use "gap" for a space surrounded by
>> polygon features but without being part of a polygon itself.
>
> I hope I managed to follow that now :)

I was just puzzled by you using "island" in your last post, thinking you 
were talking about geometries and not the real world :-)

>
>> The idea behind "Split off one part and add it as a new feature" is that you
>> cannot use "Split features" to extract a whole part (workaround would be to
>> apply "Split features" to the part and merge the two resulting new features
>> into one, but that's not intuitive :)
>
> Chaining those 2 tools manually produces exactly the output I would expect.
> - I use "Split Parts" and receive the halves which form the invalid geometry
> - then I use "Split off one part and add it as a new feature" on the
> part which I want to separate
> - make sure the primary key is valid and
> - done
>
>
this sounds like a straight workflow, although changing tools all the 
time seems a bit inconvenient :-)

Bernhard



__________ Information from ESET Mail Security, version of virus signature database 15510 (20170601) __________

The message was checked by ESET Mail Security.
http://www.eset.com





More information about the Qgis-user mailing list