class Point x Returns the X coordinate of this point: >>> OGRGeometry('POINT (1 2)').x 1.0 y Returns the Y coordinate of this point: >>> OGRGeometry('POINT (1 2)').y 2.0 z Returns the Z coordinate of this point, or None if the point does not have a Z coordinate: >>> OGRGeometry('POINT (1 2 3)').z 3.0
num Returns the number corresponding to the OGR geometry type: >>> gt1.num 3
name Returns a short-hand string form of the OGR Geometry type: >>> gt1.name 'Polygon'
django Returns the Django field type (a subclass of GeometryField) to use for storing this OGR type, or None if there is no appropriate Django type: >>> gt1.django 'PolygonField'
class OGRGeomType(type_input) This class allows for the representation of an OGR geometry type in any of several ways: >>> from django.contrib.gis.gdal import OGRGeomType >>> gt1 = OGRGeomType(3) # Using an integer for the type >>> gt2 = OGRGeomType('Polygon') # Using a string >>> gt3 = OGRGeomType('POLYGON') # It's case-insensitive >>> print(gt1 == 3, gt1 == 'Polygon') # Equivalence works w/non-OGRGeomType objects True True
__len__() Returns the number of points in a LineString, the number of rings in a Polygon, or the number of geometries in a GeometryCollection. Not applicable to other geometry types.
__iter__() Iterates over the points in a LineString, the rings in a Polygon, or the geometries in a GeometryCollection. Not applicable to other geometry types.
__getitem__() Returns the point at the specified index for a LineString, the interior ring at the specified index for a Polygon, or the geometry at the specified index in a GeometryCollection. Not applicable to other geometry types.
wkt Returns a string representation of this geometry in WKT format.
wkb_size Returns the size of the WKB buffer needed to hold a WKB representation of this geometry: >>> OGRGeometry('POINT(1 2)').wkb_size 21
Page 98 of 226