Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shapefile attribute tables do not show lines with null geometry #11350

Closed
qgib opened this issue Sep 5, 2008 · 10 comments
Closed

Shapefile attribute tables do not show lines with null geometry #11350

qgib opened this issue Sep 5, 2008 · 10 comments
Labels
Data Provider Related to specific vector, raster or mesh data providers Feature Request
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Sep 5, 2008

Author Name: Gabriele Monfardini (@gabrimonfa)
Original Redmine Issue: 1290

Redmine category:data_provider
Assignee: Marco Hugentobler


I've seen Changeset 2020. Qgis do not crash anymore viewing shapefiles with records with null geometry.
But... this records are not shown.
Since null geometries are allowed by shapefile format and these records may carry useful data, they should be shown.


@qgib
Copy link
Contributor Author

qgib commented Jul 16, 2009

Author Name: Giovanni Manghi (@gioman)


Hi,

can you please attach here a shapefile so we can do further tests? Thanks!

@qgib
Copy link
Contributor Author

qgib commented Jul 16, 2009

Author Name: Gabriele Monfardini (@gabrimonfa)


I've attached a shapefile with 3 empty geometries.
The attribute table is like that

Value | Number
aa | 1
bb | 2
cc | 0

I'm using qgis 1.2.0-Unstable Trunk at revision 11034.
The behavior is different from my first submission. Now the three rows are shown in the attribute table, but instead of the values they show the string "ERROR":

Value | Number
ERROR | ERROR
ERROR | ERROR
ERROR | ERROR

I don't know if the shapefile is exactly coherent with the shapefile format, I've created it with [[ArcView]] GIS 3.2a

@qgib
Copy link
Contributor Author

qgib commented Jul 16, 2009

Author Name: Paolo Cavallini (@pcav)


Confirmed. However, I do not see a real use case for what is essentially a non-spatial table: can you help us understanding?
Thanks

@qgib
Copy link
Contributor Author

qgib commented Jul 16, 2009

Author Name: Paolo Cavallini (@pcav)


The non-null geom is visualized, and the record shown, the others not. Do you know of other software behaving differently?

@qgib
Copy link
Contributor Author

qgib commented Jul 16, 2009

Author Name: Giovanni Manghi (@gioman)


Hi,

I had the chance to try both the shapes you posted also on arcview 3.x and arcgis 9.x

On arcview 3.x they load fine and attribute tables show the records correctly. Arcgis 9.x works differently: in the first case it gives first a "general function failure" and then, when you open the table, a "error getting a list of OIDs from the table" and shows nothing. In the second case Arcgis 3.x gives directly a "error loading feature class" and do not load the shape.

On the other hand gvSIG seems to open correctly the table.

In what situations do you use such shapefiles? Maybe do you digitize at a later time a vector and then attach it to the table?

@qgib
Copy link
Contributor Author

qgib commented Jul 16, 2009

Author Name: Gabriele Monfardini (@gabrimonfa)


Sometimes it happens to receive shapefiles with null features, but valid scalar data.
Sometimes the geometry is null by mistake and this, for example, may cause errors manipulating such features (i.e. importing or visualizing them).

So it would be useful to be able to inspect this features with qgis and see if the problem is caused by incorrect scalar data in the dbf or something else (corrupted uploaded file for example).

IMHO it is not an oddities to have a null geometry, it is not a "non-geometric" data.
AFAIK it is explicitly allowed by shapefile format to have null-geometries.
A null geometry is a perfectly legal geometry. Why this should prevent to inspect scalar data?

I think that the fact that dbf values related to null geometries are not shown is yet a bug, even if a minor one.

@qgib
Copy link
Contributor Author

qgib commented Jul 18, 2009

Author Name: Gabriele Monfardini (@gabrimonfa)


I've added a crude patch to try to solve the problem.
(Is this the correct way to provide a possible patch?)

The idea is simple, to fetch only the attributes of the null-geometry row and to mark the feature as not valid to prevent problem with rasterization.

Obviously I don't know if setting mFetchFeaturesWithoutGeom( TRUE ) in qgsvectordataprovider.cpp is a good idea, maybe better solutions are possible that affects only the ogr provider.

The patch works with my test shapefiles.

@qgib
Copy link
Contributor Author

qgib commented Jul 18, 2009

Author Name: Giovanni Manghi (@gioman)


Thanks!

I changed the owner of the ticket, so Marco will have a look to your patch when he'll be back.

@qgib
Copy link
Contributor Author

qgib commented Aug 2, 2009

Author Name: Giovanni Manghi (@gioman)


The patch works.

The second part of the patch seems to have been already implemented somehow. It remains to apply the first part "mFetchFeaturesWithoutGeom( TRUE )", if obviously the developers think it is a good idea.

@qgib
Copy link
Contributor Author

qgib commented Aug 3, 2009

Author Name: Marco Hugentobler (@mhugent)


Applied in with modifications (kept [[QgsOGRProvider]]::featureAtId consistent with [[QgsOGRProvider]]::nextFeature).
Thanks for the contribution!


  • resolution was changed from to fixed
  • status_id was changed from Open to Closed

@qgib qgib added Feature Request Data Provider Related to specific vector, raster or mesh data providers labels May 24, 2019
@qgib qgib added this to the Version 1.2.0 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Data Provider Related to specific vector, raster or mesh data providers Feature Request
Projects
None yet
Development

No branches or pull requests

1 participant