diff options
-rwxr-xr-x | gis-observation-map | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gis-observation-map b/gis-observation-map index 19dabd3..e2740c7 100755 --- a/gis-observation-map +++ b/gis-observation-map @@ -36,7 +36,9 @@ from qgis.core import ( QgsLayerDefinition, QgsLayerTreeModel, QgsMapLayer, + QgsPointXY, QgsProject, + QgsRectangle, QgsUnitTypes, QgsVectorLayer, QgsWkbTypes @@ -152,7 +154,6 @@ if projectInstance is not None: #layerTreeView.setCurrentLayer(layer) canvas = QgsMapCanvas() canvas.setExtent( layer.extent() ) - canvas.refresh() def gpkg_intersects(path, geometries): ds = gpkg_drv.Open(path, update=0) @@ -266,6 +267,14 @@ for path in args.geometry: geometries.append(geometry) feature = layer.GetNextFeature() +if len(args.geometry) == 0: + r = geometries[0].GetGeometryRef(0) + pt0X, pt0Y = r.GetPoint_2D(0) + pt1X, pt1Y = r.GetPoint_2D(2) + canvas = QgsMapCanvas() + extent = QgsRectangle(QgsPointXY(pt0X, pt0Y), QgsPointXY(pt1X, pt1Y)) + canvas.setExtent(extent) + def geometricFilterPolygon(polygon): polygon2 = [] if polygon.GetGeometryType() != ogr.wkbPolygon: |