Feature request #11319
Allow to (re)add features to null geometries
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | - | ||
Category: | Digitising | ||
Pull Request or Patch supplied: | No | Resolution: | |
Easy fix?: | No | Copied to github as #: | 19615 |
Description
It seems that since 2.4 the node tool allow to remove every node of a line/polygon feature, but this does not triggers the removal of the relative record in th attribute table.
Until 2.2 the last segment/triangle was impossible to be removed, as expected.
The specification for shapefiles says that
"The table must contain one record per shape feature."
Not sure about other formats/models.
Related issues
Associated revisions
History
#1 Updated by Arnaud Morvan about 10 years ago
For myself, it seems normal that a feature geometry can be null.
But after having removed the last point, it is impossible to create a new first point with the node tool.
It says : "could not snap to a segment on the current layer".
I've tried to had a new part, but it says: "Selected geometry could not be found".
No way found to get out of this (create a new geometry for the feature).
#2 Updated by Giovanni Manghi about 10 years ago
Arnaud Morvan wrote:
For myself, it seems normal that a feature geometry can be null.
But after having removed the last point, it is impossible to create a new first point with the node tool.
It says : "could not snap to a segment on the current layer".I've tried to had a new part, but it says: "Selected geometry could not be found".
No way found to get out of this (create a new geometry for the feature).
I think that this case is allowed in certain data types (ex. PostGIS) but it seems it is not on shapes. And anyway as you say the process is not reversible, so it should be not allowed in QGIS (as it was until 2.2). Cheers!
#3 Updated by Matthias Kuhn about 10 years ago
I work with database tables that are allowed to have NULL geometries. I therefore vote for allowing those.
To fix the current unsatisfying situation my approach would be two things:
- A layer setting "Allow NULL geometry"
- If this is set to False, pre 2.4 behavior should be applied
- If it is set to True, removing vertices leads to NULL geometry, pressing delete with a feature selection deletes the feature
- If the above interpretation of the shapefile standard is correct, this option should be disabled for shapefiles
- Add a tool to the attribute dialog that allows to digitize a geometry for a record without geometry a posteriori
#4 Updated by Giovanni Manghi about 10 years ago
Matthias Kuhn wrote:
I work with database tables that are allowed to have NULL geometries. I therefore vote for allowing those.
yes that's what I said, allowed by certain models, not allowed certainly in shapefiles.
To fix the current unsatisfying situation my approach would be two things:
- A layer setting "Allow NULL geometry"
- If this is set to False, pre 2.4 behavior should be applied
- If it is set to True, removing vertices leads to NULL geometry, pressing delete with a feature selection deletes the feature
- If the above interpretation of the shapefile standard is correct, this option should be disabled for shapefiles
- Add a tool to the attribute dialog that allows to digitize a geometry for a record without geometry a posteriori
that's ok for me
#5 Updated by Jürgen Fischer about 10 years ago
- Status changed from Open to Feedback
Are null geometries actually a invalid geometry for shape files? Are there errors on save? Can features with null geometry be removed? In that case I'd consider this a feature request for replacing the geometry of an existing feature and not a blocker.
#6 Updated by Giovanni Manghi about 10 years ago
- Status changed from Feedback to Open
Jürgen Fischer wrote:
Are null geometries actually a invalid geometry for shape files?
I cannot find a specific reference in shapefile specifications, but this
suggests that empty geometries are not allowed by it:
...
Below is the list of geometry problems:
...
Null geometry: The feature has no geometry or nothing in the SHAPE field. Null geometry errors will be deleted.
...
...
...
Are there errors on save?
there aren't, but in previous qgis releases it wasn't possible to remove (with the node tool) the very last segment of a line or the last polygon made of 3 nodes (and it also should not be possible to remove a node from a 3 nodes polygon).
Can features with null geometry be removed?
yes
In that case I'd consider this a feature request for replacing the geometry of an existing feature and not a blocker.
see link above, in my opinion it would not be a feature request, but a bug in first place. If you do not agree I suggest to at least throw a warning when the user deletes the very last node of a geometry, saying that is going to leave a orphan record (that will likely cause issues in other software packages able to read shapefiles).
#7 Updated by Jürgen Fischer about 10 years ago
Giovanni Manghi wrote:
see link above, in my opinion it would not be a feature request, but a bug in first place. If you do not agree I suggest to at least throw a warning when the user deletes the very last node of a geometry, saying that is going to leave a orphan record (that will likely cause issues in other software packages able to read shapefiles).
Well, that just lists possible problems - null geometry being one, self intersections being another - and we don't force people to avoid self intersections either. And the title just complains that the feature is not deleted, when the geometry is removed. IMHO that would be a bug - still if the user want to remove the feature with null geometry, it still can.
The shape spec states:
Null Shapes: A shape type of 0 indicates a null shape, with no geometric data for the shape. Each feature type (point, line, polygon, etc.) supports nulls it is valid to have points and null points in the same shapefile. Often null shapes are place holders; they are used during shapefile creation and are populated with geometric data soon after they are created.
So null geometries are fine. We just can't currently populate them later - but that's a missing feature.
"The table must contain one record per shape feature."
just means that shape file and dbf must have the same number of records - which is the case.
#8 Updated by Giovanni Manghi about 10 years ago
- Tracker changed from Bug report to Feature request
- Subject changed from Node tool allow to remove every node of lines and polygons but does not remove the relative record in the table of attributes to Allow to (re)add features to null geometries
- Priority changed from Severe/Regression to High
- Target version changed from Version 2.6 to Future Release - High Priority
Jürgen Fischer wrote:
And the title just complains that the feature is not deleted, when the geometry is removed. IMHO that would be a bug -
by the way:
I'm checking this reports
and I'm confirming them all. There is a serious issue at least in qgis master.
and we don't force people to avoid self intersections either
and we should really add at least an option to do not allow most of the most common mistakes: duplicate node, auto intersections, etc.
So null geometries are fine. We just can't currently populate them later - but that's a missing feature.
fine with me.
#9 Updated by Nyall Dawson about 9 years ago
- Status changed from Open to Closed
Fixed in changeset ad10b5264e45e4d298c5a256618d6bbb96a84944.