GeoScript

Previous topic

LineString

Next topic

MultiPoint

This Page

Polygon

class geoscript.geom.Polygon

A Polygon geometry.

rings is a variable number of lists of list/tuple arguments defining the rings of the polygon. The first argument is the outer ring and remaining arguments are holes.

>>> Polygon( [[1,2], [3,4], [5,6], [1,2]])
POLYGON ((1 2, 3 4, 5 6, 1 2))
>>> Polygon( [[-10,-10],[10,-10],[10,10],[-10,10],[-10,-10]], [[-5,-5],[-1,-5],[-3,-2],[-5,-5]], [[5,5],[9,5],[7,7],[5,5]] )
POLYGON ((-10 -10, 10 -10, 10 10, -10 10, -10 -10), (-5 -5, -1 -5, -3 -2, -5 -5), (5 5, 9 5, 7 7, 5 5))

rings may also be specified as a variable number of LinearRing objects.

>>> Polygon( LinearRing([-10,-10],[10,-10],[10,10],[-10,10],[-10,-10]), LinearRing([-5,-5],[-1,-5],[-3,-2],[-5,-5]), LinearRing([5,5],[9,5],[7,7],[5,5]) )
POLYGON ((-10 -10, 10 -10, 10 10, -10 10, -10 -10), (-5 -5, -1 -5, -3 -2, -5 -5), (5 5, 9 5, 7 7, 5 5))