Bug report #4375
Zoom to layer extent does not work for a point layer with a single point.
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Vectors | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | fixed/implemented |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 14307 |
Description
Just what the title says.
It does not matter whether or not on-the-fly projection is enabled.
But note that "Zoom full" does work if this is the only layer.
History
#1 Updated by Steven Mizuno about 13 years ago
Also occurs on two (or more) points having the same x- or y-coordinate, or a line that is exactly vertical or horizontal.
The reason is that Legend zoom to function bails on an empty extent, where it really ought to check the width/height individually and set an appropriate extent. And it should set some reasonable extent for a single point.
It has occurred to me that the map canvas should have a setExtent sort of function that handles zero-width or -height and adds in the 5% buffer for the various zoom to ... actions as this is a common behavior. This would make for uniform handling of such zoom requests and eliminate duplicate coding of the extent calculations especially for these special cases.
#2 Updated by Giovanni Manghi almost 13 years ago
- Target version set to Version 1.7.4
#3 Updated by Paolo Cavallini over 12 years ago
- Target version changed from Version 1.7.4 to Version 1.8.0
- Affected QGIS version set to master
- Crashes QGIS or corrupts data set to No
#4 Updated by Paolo Cavallini about 12 years ago
- Target version changed from Version 1.8.0 to Version 2.0.0
#5 Updated by Alister Hood about 11 years ago
But note that "Zoom full" does work if this is the only layer.
Not anymore. But if you select the point then zoom to selection works.
#6 Updated by Jürgen Fischer over 10 years ago
- Target version changed from Version 2.0.0 to Future Release - Lower Priority
#7 Updated by Antonio Locandro over 10 years ago
Can't you do something like add a percentage around the point so the zoom actually works, it shouldn't be a difficult fix for developers to do yet it seems to be left out for some future release which I suspect will never come considering this issue was first reported 2011. This frustrates a lots of users which expect it to work.
#8 Updated by Sandro Santilli over 9 years ago
A percentage won't work as a point has dimension 0, which multiplied by any factor is still 0.
What would work is an arbitrary scale to apply. I guess 1:1 would work.
#9 Updated by Sandro Santilli over 9 years ago
Sorry, the "apply a scale" wont work to zoom to a single layer if others also exist. Ideally for a single-point layer "zoom to layer" would just set center, not changing existing scale. The "apply an arbitrary scale" work for when no scale was set yet (ie: single point layer is the first layer being loaded).
#10 Updated by Médéric RIBREUX almost 9 years ago
- Status changed from Open to Feedback
Hello, bug triage...
it seems to be fixed: in QGIS 2.13 master, I can "zoom" on a layer with only a point. If the point layer is the only layer loaded in QGIS, the map canvas is then centered to the point but the scale is not changed. When there is another layer (tested with another polygon layer), zooming on the point layer change the scale and put the point in the view. It is not centered on the point but the point is displayed.
I think this is a good compromise. Having to zoom on only one layer loaded with only one point is far from being a common use case, so we don't really care about the scale that we can change by ourself as far as the point is visible. And when there is another layer, the point is not centered (it is up) but it is visible at a decent scale.
#11 Updated by Alister Hood almost 9 years ago
It is not centered on the point but the point is displayed.
I don't think this aspect is a good compromise - at least it will actually show the point now, but centering would be better.
#12 Updated by Giovanni Manghi almost 9 years ago
Médéric RIBREUX wrote:
Hello, bug triage...
It is not centered on the point but the point is displayed.
I cannot confirm on the latest master, it is also centered... so to me this bug is fixed. Please test and report back.
#13 Updated by Alister Hood almost 9 years ago
- Status changed from Feedback to Closed
- Resolution set to fixed/implemented
Me too.