Polygon
This class represents a polygon geometry consisting of an exterior shell and optional interior rings. It provides functionality to access individual rings by index, retrieve the exterior ring specifically, and calculate the total number of points across all rings. The class also supports exporting the geometry as a nested tuple of coordinates.
Attributes
| Attribute | Type | Description |
|---|---|---|
| exterior_ring | [OGRGeometry](ogrgeometry.md?sid=django_contrib_gis_gdal_geometries_ogrgeometry) | Return the shell of this Polygon. |
| coords | tuple | Return a tuple of LinearRing coordinate tuples. |
Methods
shell()
@classmethod
def shell() - > [OGRGeometry](ogrgeometry.md?sid=django_contrib_gis_gdal_geometries_ogrgeometry)
Return the shell of this Polygon.
Returns
| Type | Description |
|---|---|
[OGRGeometry](ogrgeometry.md?sid=django_contrib_gis_gdal_geometries_ogrgeometry) | The exterior ring (shell) of the polygon, equivalent to the first ring index |
tuple()
@classmethod
def tuple() - > tuple
Return a tuple of LinearRing coordinate tuples.
Returns
| Type | Description |
|---|---|
tuple | A nested tuple structure containing the coordinate sequences for every ring in the polygon |
point_count()
@classmethod
def point_count() - > int
Return the number of Points in this Polygon.
Returns
| Type | Description |
|---|---|
int | The aggregate sum of all points across all rings within the polygon |