How to display selected features in a map and exported as PDF

المشرف العام

Administrator
طاقم الإدارة
I've already managed to select feature by ID in a layer and zoom to it using pyqgis. The canvas considered this changes but the map that I exported as PDF doesn't consider this changes. This is my code. expr = QgsExpression("\"ID_PARCELL\"=1440") it = vlayer.getFeatures(QgsFeatureRequest(expr)) ids = [i.id() for i in it] vlayer.setSelectedFeatures(ids) box = vlayer.boundingBoxOfSelected() iface.mapCanvas().setExtent(box)

canvas = qgis.utils.iface.mapCanvas()

canvas.zoomToSelected(vlayer) iface.mapCanvas().refresh()

what do I need to add to my code to reach my goal? Thanks for advance



أكثر...
 
أعلى