Hi Viewers,
From this video, you will come to know how to use python(Python Interface) in QGIS. For better understanding, follow below program:
Python Interface
iface
help(iface)
##Add Vector layer:
iface.addVectorLayer("d:/.../points.shp","points", "ogr")
##Zoom
iface.zoomFull()
iface.zoomToPrevious()
iface.zoomToNext()
##Active Layer
layer = iface.activeLayer()
##Attribute Table
iface.showAttributeTable(layer)
##Layer Properties
iface.showLayerProperties(layer)
##New Project
iface.newProject()
##Add New Layer
help(iface.addVectorLayer)
iface.addVectorLayer("d:/.../points.shp","points", "ogr")
layer = iface.activeLayer()
dir(layer)
##Feature details (Attributes)
for f in layer.getFeatures():
print (f)
run python
..............................
for f in layer.getFeatures():
print(f['place'], f['amenity'])
run python
....................
##Coordinates (Lat, Long)
for f in layer.getFeatures():
geom = f.geometry()
print (geom.asPoint())
run python
..............
for f in layer.getFeatures():
geom = f.geometry()
print (geom.asPoint().x())
runpython
.............................
for f in layer.getFeatures():
geom = f.geometry()
print(geom.asPoint().y(), geom.asPoint().x()) (Lat (y)/Long(x))
run python
................................
##Coordinates along with Other Fields
for f in layer.getFeatures():
geom = f.geometry()
print ('%s, %s, %f, %f' % (f['place'], f['amenity'], geom.asPoint().y(), geom.asPoint().x()))
run python
.............................
Nesta página do site você pode assistir ao vídeo on-line QGIS using Python Programming for Beginners duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário MSR Geo Spatial Solutions 19 Setembro 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 46,240 vezes e gostou 445 espectadores. Boa visualização!