[Qgis-developer] RE: How to pass xMax, xMin, yMax, yMin of a current zoomed view

Echavarria Gregory, Maria Angelica m.echavarriagregory at umiami.edu
Thu Oct 22 10:51:45 EDT 2009


Barry, thanks for your answer.

>In Python or C++? An application or a plugin? What version of Qgis?

It is an application not a plugin, all in Python. I use the OSGeo4W version 1.0 Kore which runs fantastic in my WinXP. I tried 1.3 normal windows Qgis version but the installation did not work.
I have a full PyQt application which I have developed for so long (has my PhD dissertation underneath), I left the canvas part for the last task cause is what I know least, I already have the basic tools in and have checked out all available examples in the web.

> I think QgsRect is now QgsRectangle in the latest Qgis - the API doc
>will tell you what things are for:

>http://doc.qgis.org/stable/classQgsRectangle.html

Thanks... I was looking at an old API...

> Your map tool code will have to get the extent of the canvas from the
>'iface' object that it gets when it first loads. If you do:

 >ext = iface.mapCanvas().extent()

I'll try this now, but I have a question... isn't iface for plugins only? I believed it was to capture Qgis' built-in canvas to work with it from a plugin's code...

> then you get a QgsRectangle object that you can pass around. I'm not
>sure at the moment if this is in projected coordinates though... You
>may need to apply a transform... There's still a lot to do!

I have a question regarding transforms: when you apply a transform, I understand that Qgis will give me all values in the new system, but, DOES THE ACTUAL DRAWING CHANGE? it doesn't, right? I need to find a class (if exists) to build a tool that also changes the actual drawing (could be vector or raster) or I'll have to find new maps in UTM. Reason is that the results of my program are rasters in UTM projection and I need to superimpose them to a UTM-projected base map. Could you please help me out with this question, too?

>Barry

Many many thanks,
Angelica.


More information about the Qgis-developer mailing list