[Qgis-developer] setting size of mapcanvas / map via python in plugin

Richard Duivenvoorde rdmailings at duif.net
Sun Oct 3 13:17:48 EDT 2010


Ok, found it sort of... using python you can resize the Qt-parent
component that QgsMapCanvas inherits from.

Now implemented in HtmlImageMap Plugin: ability to set mapcanvas size,
hence setting output size of image of the map.

Regards,

Richard

Richard Duivenvoorde wrote:
> 
> Hi Devs,
> 
> looking at: http://doc.qgis.org/stable/classQgsMapCanvas.html
> is my conclusion ok that I cannot change the size of the mapcanvas from
> within a python plugin / programmatically?
> 
> For the htmlimagemaplugin there is a feature request to be able to
> determine the exact size of the output map image.
> 
> Another use-case is when I needed to have an image of a map in an exact
> size to be used in some html/css page.
> 
> Till now I tried to resize the window in such a way combined with saving
> the map as an image to determine the right size (pixelperfect :-) )
> 
> Am I missing something here (eg can I use the qt-parent of mapcanvast or
> so?) or should I file a feature request?
> 
> 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