-
-
Save oscar9/cbea8e8bf915d155bdc3ca5134e19d43 to your computer and use it in GitHub Desktop.
Access to vertices of gvSIG geometries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
import gvsig | |
from gvsig import geom | |
def main(*args): | |
layer = gvsig.currentLayer() | |
features = layer.features() | |
# Acceso al tipo poligono | |
print geom.POLYGON | |
# Convirtiendo poligono a multipunto con toPoints() | |
for f in features: | |
mp = f.geometry().toPoints() | |
print "punto0: ", mp.getPointAt(0) | |
print "numero de puntos: ", mp.getPrimitivesNumber() | |
# Trabajando con el poligono directamente | |
for f in features: | |
num = f.geometry().getNumVertices() | |
for i in range(0, num): | |
print "punto ", i , ": ", f.geometry().getVertex(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment