Bug report #1822
Zoom to point: exaggerated zoom
Status: | Closed | ||
---|---|---|---|
Priority: | Low | ||
Assignee: | Gary Sherman | ||
Category: | Python plugins | ||
Affected QGIS version: | Regression?: | No | |
Operating System: | All | Easy fix?: | No |
Pull Request or Patch supplied: | Resolution: | fixed | |
Crashes QGIS or corrupts data: | Copied to github as #: | 11882 |
Description
I'm getting a weird behaviour with "zoom to point", I get
an exaggerated zoom unless I set values around 90 (qgis 1.1.0 Pan unstable on
ubuntu 9.04)
Also, would it be possible to get the point marked with a circle
or something so that you can fine tune the zoom and pan, and even
get the point saved to a points vector layer?
History
#1 Updated by Paolo Cavallini over 15 years ago
- Status changed from Open to Closed
- Resolution set to duplicate
Duplicate of #1588
#2 Updated by gcarrillo - over 15 years ago
This is related to the Gary's plugin? If this is, please reopen the ticket because I have a suggestion :)
I think the #1588 is related to ZoomToSelected method (QgsMapCanvas class), I guess #1588 and this aren't the same thing, but please forgive me If I'm wrong.
#3 Updated by Borys Jurgiel over 15 years ago
- Resolution deleted (
duplicate) - Status changed from Closed to Feedback
yes, you're right
#4 Updated by Borys Jurgiel over 15 years ago
- Status changed from Feedback to Open
#5 Updated by gcarrillo - over 15 years ago
I think the exaggerated zoom depends on what scale are your data.
Maybe the scale factor could be a relative factor with the canvas fullExtent as base extent.
Something like this can be useful (zoomtopoint.py file, run() method):
mc=self.iface.mapCanvas()
extent = mc.fullExtent()
xmin = float(x) - extent.width() / ( 2 * ( 100-scale ) )
xmax = float(x) + extent.width() / ( 2* ( 100-scale ) )
ymin = float(y) - extent.height() / (2 * ( 100-scale ) )
ymax = float(y) + extent.height() / ( 2 *( 100-scale ) )
rect = [[QgsRectangle]]( xmin, ymin, xmax, ymax )
mc.setExtent(rect)
x, y are the point coordinates to center
scale is the factor (1 to detailed scale, 99 to general scale)
#6 Updated by Borys Jurgiel almost 14 years ago
- Status changed from Open to Closed
- Resolution set to fixed
Applied as version 1.1, with a small modification: extent.width() / 200 * scale
So scale n means n% of the full extent.