AW: [Qgis-developer] set mapunitsperpixel
Hugentobler Marco
marco.hugentobler at karto.baug.ethz.ch
Sun Nov 23 15:51:02 EST 2008
Hi Richard
One possibility is to find out the scale for the current extent and then set the new extent such that it meets your target scale. You then may set the calculated extent with the method QgsMapRenderer::setExtent (or QgsMapCanvas::setExtent is also possible). You may look how it is done in the class QgsComposerMap::setNewScale.
>Another question: in the python console if I do a scale(1), why is the
>map zooming in and out? Shouldn't the bbox stay the same with a 1?
In QgsMapCanvas, C++, there are two methods, one zoom(bool) and one zoom(double). In the python bindings, there is only zoom(bool), so zoom(1) means true (zoom in).
>Looking at the qgsrasterlayer and it seems pretty hard bound to the
>wmsrasterprovider. Am I right?
Yes, there is no other raster provider so far. So it could be that you need to do some changes in the raster classes to implement tmsrasterprovider.
Regards,
Marco
-----Ursprüngliche Nachricht-----
Von: qgis-developer-bounces at lists.osgeo.org im Auftrag von Richard Duivenvoorde
Gesendet: So 23.11.2008 20:31
An: qgis-developer
Betreff: [Qgis-developer] set mapunitsperpixel
Hi Devs,
doing my first steps in cpp (starting off with a tmsrasterprovider), I
thought to zoom to a certain scale first (so I do not need to scale the
tiles).
But HOW is this done?
There is no 'zoomToScale' or 'zoomToMupp' or so.
And trying (using python console) to resize the mapcanvas first to
512x512 and then zoom to a calculated bounding box of 512*XXX (where XXX
is the wanted mupp) gives a zoomin/out action, but asking for the
mapUnitsPerPixel after that does NOT give me XXX? Any thoughts about that?
Another question: in the python console if I do a scale(1), why is the
map zooming in and out? Shouldn't the bbox stay the same with a 1?
Looking at the qgsrasterlayer and it seems pretty hard bound to the
wmsrasterprovider. Am I right?
Regards,
Richard Duivenvoorde
_______________________________________________
Qgis-developer mailing list
Qgis-developer at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer
More information about the Qgis-developer
mailing list