Skip to content

Instantly share code, notes, and snippets.

@oscar9
Created March 1, 2017 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oscar9/cbea8e8bf915d155bdc3ca5134e19d43 to your computer and use it in GitHub Desktop.
Save oscar9/cbea8e8bf915d155bdc3ca5134e19d43 to your computer and use it in GitHub Desktop.
Access to vertices of gvSIG geometries
# 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