gis.db.models.functions.BoundingCircle

class BoundingCircle(expression, num_seg=48, **extra) Availability: PostGIS Accepts a single geographic field or expression and returns the smallest circle polygon that can fully contain the geometry.

gis.db.models.functions.Centroid

class Centroid(expression, **extra) Availability: MySQL, PostGIS, Oracle, SpatiaLite Accepts a single geographic field or expression and returns the centroid value of the geometry.

gis.db.models.functions.Difference

class Difference(expr1, expr2, **extra) Availability: MySQL (≥ 5.6.1), PostGIS, Oracle, SpatiaLite Accepts two geographic fields or expressions and returns the geometric difference, that is the part of geometry A that does not intersect with geometry B. Changed in Django 1.10: MySQL support was added.

gis.db.models.functions.AsKML

class AsKML(expression, precision=8, **extra) Availability: PostGIS, SpatiaLite Accepts a single geographic field or expression and returns a Keyhole Markup Language (KML) representation of the geometry. Example: >>> qs = Zipcode.objects.annotate(kml=AsKML('poly')) >>> print(qs[0].kml) <Polygon><outerBoundaryIs><LinearRing><coordinates>-103.04135,36.217596,0 ... -103.04135,36.217596,0</coordinates></LinearRing></outerBoundaryIs><

gis.db.models.functions.Area

class Area(expression, **extra) Availability: MySQL, Oracle, PostGIS, SpatiaLite Accepts a single geographic field or expression and returns the area of the field as an Area measure. On MySQL, a raw float value is returned, as it’s not possible to automatically determine the unit of the field.

gis.db.models.functions.AsSVG

class AsSVG(expression, relative=False, precision=8, **extra) Availability: PostGIS, SpatiaLite Accepts a single geographic field or expression and returns a Scalable Vector Graphics (SVG) representation of the geometry. Keyword Argument Description relative If set to True, the path data will be implemented in terms of relative moves. Defaults to False, meaning that absolute moves are used instead. precision This keyword may be used to specify the number of significant digits for the coordin

gis.db.models.functions.AsGML

class AsGML(expression, version=2, precision=8, **extra) Availability: Oracle, PostGIS, SpatiaLite Accepts a single geographic field or expression and returns a Geographic Markup Language (GML) representation of the geometry. Example: >>> qs = Zipcode.objects.annotate(gml=AsGML('poly')) >>> print(qs[0].gml) <gml:Polygon srsName="EPSG:4326"><gml:OuterBoundaryIs>-147.78711,70.245363 ... -147.78711,70.245363</gml:OuterBoundaryIs></gml:Polygon> Keyword

gis.db.models.functions.AsGeoJSON

class AsGeoJSON(expression, bbox=False, crs=False, precision=8, **extra) Availability: PostGIS, SpatiaLite Accepts a single geographic field or expression and returns a GeoJSON representation of the geometry. Note that the result is not a complete GeoJSON structure but only the geometry key content of a GeoJSON structure. See also GeoJSON Serializer. Example: >>> City.objects.annotate(json=AsGeoJSON('point')).get(name='Chicago').json {"type":"Point","coordinates":[-87.65018,41.85039

gis.db.models.BaseSpatialField.srid

BaseSpatialField.srid Sets the SRID [2] (Spatial Reference System Identity) of the geometry field to the given value. Defaults to 4326 (also known as WGS84, units are in degrees of longitude and latitude).

gis.db.models.Extent

class Extent(geo_field) Availability: PostGIS, Oracle, SpatiaLite Returns the extent of all geo_field in the QuerySet as a four-tuple, comprising the lower left coordinate and the upper right coordinate. Example: >>> qs = City.objects.filter(name__in=('Houston', 'Dallas')).aggregate(Extent('poly')) >>> print(qs['poly__extent']) (-96.8016128540039, 29.7633724212646, -95.3631439208984, 32.782058715820)