gis.db.models.functions.NumGeometries

class NumGeometries(expression, **extra) Availability: MySQL, PostGIS, Oracle, SpatiaLite Accepts a single geographic field or expression and returns the number of geometries if the geometry field is a collection (e.g., a GEOMETRYCOLLECTION or MULTI* field); otherwise returns None.

gis.db.models.functions.MemSize

class MemSize(expression, **extra) Availability: PostGIS Accepts a single geographic field or expression and returns the memory size (number of bytes) that the geometry field takes.

gis.db.models.functions.MakeValid

class MakeValid(expr) New in Django 1.10. Availability: PostGIS Accepts a geographic field or expression and attempts to convert the value into a valid geometry without losing any of the input vertices. Geometries that are already valid are returned without changes. Simple polygons might become a multipolygon and the result might be of lower dimension than the input.

gis.db.models.functions.Length

class Length(expression, spheroid=True, **extra) Availability: MySQL, Oracle, PostGIS, SpatiaLite Accepts a single geographic linestring or multilinestring field or expression and returns its length as an Distance measure. On MySQL, a raw float value is returned, as it’s not possible to automatically determine the unit of the field. On PostGIS and SpatiaLite, when the coordinates are geodetic (angular), you can specify if the calculation should be based on a simple sphere (less accurate, les

gis.db.models.functions.IsValid

class IsValid(expr) New in Django 1.10. Availability: PostGIS Accepts a geographic field or expression and tests if the value is well formed. Returns True if its value is a valid geometry and False otherwise.

gis.db.models.functions.Intersection

class Intersection(expr1, expr2, **extra) Availability: MySQL (≥ 5.6.1), PostGIS, Oracle, SpatiaLite Accepts two geographic fields or expressions and returns the geometric intersection between them. Changed in Django 1.10: MySQL support was added.

gis.db.models.functions.GeoHash

class GeoHash(expression, precision=None, **extra) Availability: PostGIS, SpatiaLite (≥ 4.0, LWGEOM) Accepts a single geographic field or expression and returns a GeoHash representation of the geometry. The precision keyword argument controls the number of characters in the result. Changed in Django 1.10: SpatiaLite support was added.

gis.db.models.functions.ForceRHR

class ForceRHR(expression, **extra) Availability: PostGIS Accepts a single geographic field or expression and returns a modified version of the polygon/multipolygon in which all of the vertices follow the right-hand rule.

gis.db.models.functions.Envelope

class Envelope(expression, **extra) Availability: MySQL, PostGIS, SpatiaLite Accepts a single geographic field or expression and returns the geometry representing the bounding box of the geometry.

gis.db.models.functions.Distance

class Distance(expr1, expr2, spheroid=None, **extra) Availability: MySQL (≥ 5.6.1), PostGIS, Oracle, SpatiaLite Accepts two geographic fields or expressions and returns the distance between them, as a Distance object. On MySQL, a raw float value is returned, as it’s not possible to automatically determine the unit of the field. On backends that support distance calculation on geodetic coordinates, the proper backend function is automatically chosen depending on the SRID value of the geometri