Hi, I'm trying to print a map using pyqgis and an existing template: # i already loaded a layer and zoomed to the layer:
qgis.utils.iface.zoomToActiveLayer() # now i need to zoom to a "precise" scale canvas = qgis.utils.iface.mapCanvas() canvas.zoomScale(2500) # this works for the canvas not in the composer # load the template template_file = file(template_path) template_content = template_file.read() template_file.close() document = QDomDocument() document.setContent(template_content) composition = QgsComposition(canvas.mapSettings()) composition.loadFromTemplate(document) map_item = composition.getComposerItemById('map') map_item.setMapCanvas(canvas) # at this point i need to set the extent to fit the layer map_item.zoomToExtent(canvas.extent()) # this will not be in scale 2500 of course now i need the scale to be say 2500 but i cannot find how to set the value thanks for any help, Roy _______________________________________________ Qgis-developer mailing list Qgis-developer@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer