Skip to main content
Tweeted twitter.com/StackGIS/status/1175922930993287168
edited body; edited title
Source Link
Jochen Schwarze
  • 14.9k
  • 8
  • 54
  • 120

Extract coordinates from vector layer in PyQgisPyQGIS

In QgisQGIS, I have made a polygon, and from that polygon I have made a vector grid via research tools-> vector grid. The grid covers the entire polygon.

Now I want to extract these grid points in the python console so I can work with them. But I can not figure out how to extract these coordinates.

I have done the following:

Layer = qgis.utils.iface.activeLayer()
provider = Layer.dataProvider()
feat = QgsFeature()
allAttrs = provider.attributeIndexes()
provider.select(allAttrs)
geom = feat.geometry()

but from here I do not know what to do. Any help?

Extract coordinates from vector layer in PyQgis

In Qgis, I have made a polygon, and from that polygon I have made a vector grid via research tools-> vector grid. The grid covers the entire polygon.

Now I want to extract these grid points in the python console so I can work with them. But I can not figure out how to extract these coordinates.

I have done the following:

Layer = qgis.utils.iface.activeLayer()
provider = Layer.dataProvider()
feat = QgsFeature()
allAttrs = provider.attributeIndexes()
provider.select(allAttrs)
geom = feat.geometry()

but from here I do not know what to do. Any help?

Extract coordinates from vector layer in PyQGIS

In QGIS, I have made a polygon, and from that polygon I have made a vector grid via research tools-> vector grid. The grid covers the entire polygon.

Now I want to extract these grid points in the python console so I can work with them. But I can not figure out how to extract these coordinates.

I have done the following:

Layer = qgis.utils.iface.activeLayer()
provider = Layer.dataProvider()
feat = QgsFeature()
allAttrs = provider.attributeIndexes()
provider.select(allAttrs)
geom = feat.geometry()

but from here I do not know what to do. Any help?

added 12 characters in body
Source Link
vinayan
  • 7.3k
  • 3
  • 37
  • 76

In Qgis, I have made a polygon, and from that polygon I have made a vector grid via research tools-> vector grid. The grid covers the entire polygon.

Now I want to extract these grid points in the python console so I can work with them. But I can not figure out how to extract these coordinates.

I have done the following:

  • Layer = qgis.utils.iface.activeLayer()
  • provider = Layer.dataProvider()
  • feat = QgsFeature()
  • allAttrs = provider.attributeIndexes()
  • provider.select(allAttrs)
  • geom = feat.geometry()
Layer = qgis.utils.iface.activeLayer()
provider = Layer.dataProvider()
feat = QgsFeature()
allAttrs = provider.attributeIndexes()
provider.select(allAttrs)
geom = feat.geometry()

but from here I do not know what to do. Any help?

In Qgis, I have made a polygon, and from that polygon I have made a vector grid via research tools-> vector grid. The grid covers the entire polygon.

Now I want to extract these grid points in the python console so I can work with them. But I can not figure out how to extract these coordinates.

I have done the following:

  • Layer = qgis.utils.iface.activeLayer()
  • provider = Layer.dataProvider()
  • feat = QgsFeature()
  • allAttrs = provider.attributeIndexes()
  • provider.select(allAttrs)
  • geom = feat.geometry()

but from here I do not know what to do. Any help?

In Qgis, I have made a polygon, and from that polygon I have made a vector grid via research tools-> vector grid. The grid covers the entire polygon.

Now I want to extract these grid points in the python console so I can work with them. But I can not figure out how to extract these coordinates.

I have done the following:

Layer = qgis.utils.iface.activeLayer()
provider = Layer.dataProvider()
feat = QgsFeature()
allAttrs = provider.attributeIndexes()
provider.select(allAttrs)
geom = feat.geometry()

but from here I do not know what to do. Any help?

edited title
Link
Toke
  • 379
  • 1
  • 5
  • 13

Extract corner coordinates from vector layer in PyQgis

added 12 characters in body
Source Link
Toke
  • 379
  • 1
  • 5
  • 13
Loading
Source Link
Toke
  • 379
  • 1
  • 5
  • 13
Loading