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

QgsVectorLayer.select( QgsVectorLayer.extent(), true) does not return all features #12718

Closed
qgib opened this issue Apr 15, 2010 · 5 comments
Closed
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats)
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Apr 15, 2010

Author Name: ersts - (ersts -)
Original Redmine Issue: 2658

Redmine category:vectors
Assignee: nobody -


select() does is not returning all features, when using the layer's extent as the input rectangle.

This can be reproduced by grabbing the data provided with ticket #12681. Load the shadefile ( 12 points ) and enter the following in to the python console

lvActiveLayer = qgis.utils.iface.activeLayer()
lvExtent = lvActiveLayer.extent()
lvActiveLayer.select(lvExtent, True)

The western, northern, and southern most points are not selected. I get the same result using the c++ api

However, I have check another point layer ( also a shapefile ) and get similar but inconsistent results. From the python console the southern most point is not selected, but through the c++ api all points are selected.

I am running on stock Ubuntu 10.04, trunk r13316

@qgib
Copy link
Contributor Author

qgib commented May 5, 2010

Author Name: Martin Dobias (@wonder-sk)


Peter,


I believe the problem is caused by some subtle differences among the values of floating point numbers of coordinates. For example, extent passed to [[PostGIS]] database is first encoded as a string and then decoded back to double value, so there is obvious space for loosing the precision.

Martin


---

-  resolution  was changed from    to wontfix 
-  status_id  was changed from   Open   to Closed 

@qgib
Copy link
Contributor Author

qgib commented May 5, 2010

Author Name: ersts - (ersts -)


Howdy Martin,
I also think it has to do with comparing floats/doubles.

The example I gave happens to be from the same layer. It could just as easily been the extent from layer A being used to select features from layer B. Even if there are other ways to select everything from a layer, it seems that using the layer's extent should always give you all the features.

I am not sure this should just be ignored.

@qgib
Copy link
Contributor Author

qgib commented May 5, 2010

Author Name: Martin Dobias (@wonder-sk)


Well, I am not sure what can we do here apart from expanding the extent with some small deltas when doing the select, because the spatial filtering is typically done in third-party libraries.

CGAL library has an interesting article on the topic: http://www.cgal.org/philosophy.html

@qgib
Copy link
Contributor Author

qgib commented May 9, 2010

Author Name: Donkagen2 - (Donkagen2 -)


Replying to [comment:3 wonder]:

The original bug #12681 was that eVis Event Browser misses records, sometimes a lot of them.

If a solution isn't found then, for all practical purposes, the Event Browser is terminally broken. Are there not also likely to be many other applications of this function where this bug will cause similar problems because the function doesn't do "what it says on the box"?

@qgib
Copy link
Contributor Author

qgib commented May 9, 2010

Author Name: ersts - (ersts -)


no no. There are other ways to select all the features, all is not lost!

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats) labels May 24, 2019
@qgib qgib added this to the Version 1.5.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
Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats)
Projects
None yet
Development

No branches or pull requests

1 participant