Opened 15 years ago

Closed 13 years ago

#1822 closed bug (fixed)

Zoom to point: exaggerated zoom

Reported by: alobo Owned by: gsherman
Priority: major: does not work as expected Milestone: Version 1.7.0
Component: Python plugins and bindings Version: Trunk
Keywords: Cc:
Must Fix for Release: No Platform: All
Platform Version: Awaiting user input: no

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?

Change History (7)

comment:1 by pcav, 15 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #1588

comment:2 by gcarrillo, 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.

comment:3 by borysiasty, 15 years ago

Resolution: duplicate
Status: closedreopened

yes, you're right

comment:4 by borysiasty, 15 years ago

Owner: changed from borysiasty to gsherman
Status: reopenednew

comment:5 by gcarrillo, 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)

comment:6 by pcav, 14 years ago

Milestone: Version 1.5.0Version 1.6.0
Must Fix for Release: YesNo

comment:7 by borysiasty, 13 years ago

Platform: LinuxAll
Resolution: fixed
Status: newclosed

Applied as version 1.1, with a small modification: extent.width() / 200 * scale

So scale n means n% of the full extent.

Note: See TracTickets for help on using tickets.