Skip to main content

GEOSGeometryBase

This class serves as the base for GEOS geometry objects, providing a comprehensive interface for spatial operations, topological analysis, and coordinate management. It supports various input and output formats including WKT, WKB, GeoJSON, and KML, while implementing Pythonic operator overloading for geometric set operations like union and intersection. The class manages underlying C pointers for GEOS geometries and facilitates integration with GDAL for spatial reference transformations.

Attributes

AttributeTypeDescription
ptr_typetype = GEOM_PTRThe C pointer type used for the underlying GEOS geometry object.
destructorcallable = capi.destroy_geomThe C API function responsible for freeing the memory associated with the GEOS geometry pointer.
has_csboolean = falseA boolean flag indicating whether the geometry type supports coordinate sequences; only Point, LineString, and LinearRing have them.
geojsonstring = nullReturn GeoJSON representation of this Geometry.

Constructor

Signature

def GEOSGeometryBase(
ptr: GEOM_PTR,
cls: class
) - > null

Parameters

NameTypeDescription
ptrGEOM_PTRThe pointer to the GEOS geometry object.
clsclassThe specific geometry class to assign to the instance.

Methods


from_ewkt()

@classmethod
def from_ewkt(
ewkt: string
) - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Creates a GEOSGeometry instance from an Extended Well-Known Text string, extracting the SRID if present.

Parameters

NameTypeDescription
ewktstringThe Extended Well-Known Text string containing geometry and optional SRID.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A new geometry object initialized with the provided EWKT data.

from_gml()

@classmethod
def from_gml(
gml_string: string
) - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Creates a GEOSGeometry instance from a GML string using GDAL's OGRGeometry conversion.

Parameters

NameTypeDescription
gml_stringstringThe Geography Markup Language string to parse.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A new geometry object derived from the GML input.

coord_seq()

@classmethod
def coord_seq() - > [GEOSCoordSeq](../coordseq/geoscoordseq.md?sid=django_contrib_gis_geos_coordseq_geoscoordseq)

Return a clone of the coordinate sequence for this Geometry.

Returns

TypeDescription
[GEOSCoordSeq](../coordseq/geoscoordseq.md?sid=django_contrib_gis_geos_coordseq_geoscoordseq)A copy of the coordinate sequence, or None if the geometry does not support them.

geom_type()

@classmethod
def geom_type() - > string

Return a string representing the Geometry type, e.g. 'Polygon'

Returns

TypeDescription
stringThe name of the geometry type.

geom_typeid()

@classmethod
def geom_typeid() - > integer

Return an integer representing the Geometry type.

Returns

TypeDescription
integerThe internal GEOS ID for the geometry type.

num_geom()

@classmethod
def num_geom() - > integer

Return the number of geometries in the Geometry.

Returns

TypeDescription
integerThe count of sub-geometries (e.g., in a GeometryCollection).

num_coords()

@classmethod
def num_coords() - > integer

Return the number of coordinates in the Geometry.

Returns

TypeDescription
integerThe total count of vertices in the geometry.

num_points()

@classmethod
def num_points() - > integer

Return the number of points, or coordinates, in the Geometry.

Returns

TypeDescription
integerThe total count of vertices in the geometry.

dims()

@classmethod
def dims() - > integer

Return the dimension of this Geometry (0=point, 1=line, 2=surface).

Returns

TypeDescription
integerThe topological dimension of the geometry.

normalize()

@classmethod
def normalize(
clone: boolean
) - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Convert this Geometry to normal form (or canonical form). If the clone keyword is set, then the geometry is not modified and a normalized clone of the geometry is returned instead.

Parameters

NameTypeDescription
clonebooleanIf True, returns a normalized copy without modifying the original.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A normalized clone if clone=True, otherwise None.

make_valid()

@classmethod
def make_valid() - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Attempt to create a valid representation of a given invalid geometry without losing any of the input vertices.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A new valid GEOSGeometry instance.

empty()

@classmethod
def empty() - > boolean

Return a boolean indicating whether the set of points in this Geometry are empty.

Returns

TypeDescription
booleanTrue if the geometry contains no points.

hasz()

@classmethod
def hasz() - > boolean

Return whether the geometry has a Z dimension.

Returns

TypeDescription
booleanTrue if the geometry is 3D.

hasm()

@classmethod
def hasm() - > boolean

Return whether the geometry has a M dimension.

Returns

TypeDescription
booleanTrue if the geometry contains measure values (requires GEOS >= 3.12.0).

ring()

@classmethod
def ring() - > boolean

Return whether or not the geometry is a ring.

Returns

TypeDescription
booleanTrue if the geometry is a closed and simple LineString.

simple()

@classmethod
def simple() - > boolean

Return false if the Geometry isn't simple.

Returns

TypeDescription
booleanTrue if the geometry has no anomalous geometric points, such as self-intersection.

valid()

@classmethod
def valid() - > boolean

Test the validity of this Geometry.

Returns

TypeDescription
booleanTrue if the geometry is topologically valid.

valid_reason()

@classmethod
def valid_reason() - > string

Return a string containing the reason for any invalidity.

Returns

TypeDescription
stringA text description explaining why the geometry is invalid, or 'Valid Geometry'.

contains()

@classmethod
def contains(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > boolean

Return true if other.within(this) returns true.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to test for containment.

Returns

TypeDescription
booleanTrue if this geometry contains the other.

covers()

@classmethod
def covers(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > boolean

Return True if the DE-9IM Intersection Matrix for the two geometries is T**FF*, TFF*, TFF, or **TFF. If either geometry is empty, return False.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to test for coverage.

Returns

TypeDescription
booleanTrue if this geometry covers the other.

crosses()

@classmethod
def crosses(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > boolean

Return true if the DE-9IM intersection matrix for the two Geometries is TT***** (for a point and a curve,a point and an area or a line and an area) 0******** (for two curves).

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to test for crossing.

Returns

TypeDescription
booleanTrue if the geometries cross each other.

disjoint()

@classmethod
def disjoint(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > boolean

Return true if the DE-9IM intersection matrix for the two Geometries is FFFF***.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to test for disjointness.

Returns

TypeDescription
booleanTrue if the geometries have no points in common.

equals()

@classmethod
def equals(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > boolean

Return true if the DE-9IM intersection matrix for the two Geometries is TF**FFF.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to compare.

Returns

TypeDescription
booleanTrue if the geometries are spatially equal.

equals_exact()

@classmethod
def equals_exact(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry),
tolerance: float
) - > boolean

Return true if the two Geometries are exactly equal, up to a specified tolerance.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to compare.
tolerancefloatThe numeric threshold for coordinate comparison.

Returns

TypeDescription
booleanTrue if the geometries are equal within the given numeric threshold.

equals_identical()

@classmethod
def equals_identical(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > boolean

Return true if the two Geometries are point-wise equivalent.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to compare.

Returns

TypeDescription
booleanTrue if the geometries are identical (requires GEOS >= 3.12.0).

intersects()

@classmethod
def intersects(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > boolean

Return true if disjoint return false.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to test for intersection.

Returns

TypeDescription
booleanTrue if the geometries share any points.

overlaps()

@classmethod
def overlaps(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > boolean

Return true if the DE-9IM intersection matrix for the two Geometries is TTT (for two points or two surfaces) 1TT (for two curves).

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to test for overlap.

Returns

TypeDescription
booleanTrue if the geometries overlap.

relate_pattern()

@classmethod
def relate_pattern(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry),
pattern: string
) - > boolean

Return true if the elements in the DE-9IM intersection matrix for the two Geometries match the elements in pattern.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to relate to.
patternstringA 9-character DE-9IM intersection matrix pattern string.

Returns

TypeDescription
booleanTrue if the spatial relationship matches the DE-9IM pattern.

touches()

@classmethod
def touches(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > boolean

Return true if the DE-9IM intersection matrix for the two Geometries is FT*******, FT*** or F*T**.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to test for contact.

Returns

TypeDescription
booleanTrue if the geometries touch but do not overlap their interiors.

within()

@classmethod
def within(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > boolean

Return true if the DE-9IM intersection matrix for the two Geometries is TFF.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to test for containment.

Returns

TypeDescription
booleanTrue if this geometry is entirely inside the other.

srid()

@classmethod
def srid() - > integer

Get or set the Spatial Reference ID (SRID) for the geometry.

Returns

TypeDescription
integerThe SRID integer, or None if not set.

ewkt()

@classmethod
def ewkt() - > string

Return the EWKT (SRID + WKT) of the Geometry.

Returns

TypeDescription
stringThe Extended Well-Known Text string.

wkt()

@classmethod
def wkt() - > string

Return the WKT (Well-Known Text) representation of this Geometry.

Returns

TypeDescription
stringThe Well-Known Text string.

hex()

@classmethod
def hex() - > string

Return the WKB of this Geometry in hexadecimal form. Please note that the SRID is not included in this representation because it is not a part of the OGC specification (use the hexewkb property instead).

Returns

TypeDescription
stringThe hexadecimal WKB string.

hexewkb()

@classmethod
def hexewkb() - > string

Return the EWKB of this Geometry in hexadecimal form. This is an extension of the WKB specification that includes SRID value that are a part of this geometry.

Returns

TypeDescription
stringThe hexadecimal EWKB string.

json()

@classmethod
def json() - > string

Return GeoJSON representation of this Geometry.

Returns

TypeDescription
stringA JSON string formatted according to the GeoJSON specification.

wkb()

@classmethod
def wkb() - > memoryview

Return the WKB (Well-Known Binary) representation of this Geometry as a Python memoryview. SRID and Z values are not included, use the ewkb property instead.

Returns

TypeDescription
memoryviewA memoryview containing the binary WKB data.

ewkb()

@classmethod
def ewkb() - > memoryview

Return the EWKB representation of this Geometry as a Python memoryview. This is an extension of the WKB specification that includes any SRID value that are a part of this geometry.

Returns

TypeDescription
memoryviewA memoryview containing the binary EWKB data.

kml()

@classmethod
def kml() - > string

Return the KML representation of this Geometry.

Returns

TypeDescription
stringAn XML string formatted for Keyhole Markup Language.

prepared()

@classmethod
def prepared() - > [PreparedGeometry](../prepared/preparedgeometry.md?sid=django_contrib_gis_geos_prepared_preparedgeometry)

Return a PreparedGeometry corresponding to this geometry -- it is optimized for the contains, intersects, and covers operations.

Returns

TypeDescription
[PreparedGeometry](../prepared/preparedgeometry.md?sid=django_contrib_gis_geos_prepared_preparedgeometry)An optimized version of the geometry for spatial queries.

ogr()

@classmethod
def ogr() - > [OGRGeometry](../../gdal/geometries/ogrgeometry.md?sid=django_contrib_gis_gdal_geometries_ogrgeometry)

Return the OGR Geometry for this Geometry.

Returns

TypeDescription
[OGRGeometry](../../gdal/geometries/ogrgeometry.md?sid=django_contrib_gis_gdal_geometries_ogrgeometry)A GDAL/OGR representation of the geometry.

srs()

@classmethod
def srs() - > [SpatialReference](../../gdal/srs/spatialreference.md?sid=django_contrib_gis_gdal_srs_spatialreference)

Return the OSR SpatialReference for SRID of this Geometry.

Returns

TypeDescription
[SpatialReference](../../gdal/srs/spatialreference.md?sid=django_contrib_gis_gdal_srs_spatialreference)A GDAL SpatialReference object, or None if the SRID is invalid or not set.

crs()

@classmethod
def crs() - > [SpatialReference](../../gdal/srs/spatialreference.md?sid=django_contrib_gis_gdal_srs_spatialreference)

Alias for srs property.

Returns

TypeDescription
[SpatialReference](../../gdal/srs/spatialreference.md?sid=django_contrib_gis_gdal_srs_spatialreference)The spatial reference system of the geometry.

transform()

@classmethod
def transform(
ct: object,
clone: boolean
) - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Requires GDAL. Transform the geometry according to the given transformation object, which may be an integer SRID, and WKT or PROJ string. By default, transform the geometry in-place and return nothing. However if the clone keyword is set, don't modify the geometry and return a transformed clone instead.

Parameters

NameTypeDescription
ctobjectThe target coordinate system, specified as an SRID integer, WKT string, PROJ string, or CoordTransform object.
clonebooleanIf True, returns a transformed copy without modifying the original.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A transformed clone if clone=True, otherwise None.

boundary()

@classmethod
def boundary() - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Return the boundary as a newly allocated Geometry object.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A geometry representing the boundary of the current geometry.

buffer()

@classmethod
def buffer(
width: float,
quadsegs: integer
) - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Return a geometry that represents all points whose distance from this Geometry is less than or equal to distance. Calculations are in the Spatial Reference System of this Geometry. The optional third parameter sets the number of segment used to approximate a quarter circle (defaults to 8). (Text from PostGIS documentation at ch. 6.1.3)

Parameters

NameTypeDescription
widthfloatThe distance to buffer the geometry by.
quadsegsintegerThe number of segments used to approximate a quarter circle.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A geometry representing the buffered area.

buffer_with_style()

@classmethod
def buffer_with_style(
width: float,
quadsegs: integer,
end_cap_style: integer,
join_style: integer,
mitre_limit: float
) - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Same as buffer() but allows customizing the style of the memoryview. End cap style can be round (1), flat (2), or square (3). Join style can be round (1), mitre (2), or bevel (3). Mitre ratio limit only affects mitered join style.

Parameters

NameTypeDescription
widthfloatThe distance to buffer the geometry by.
quadsegsintegerThe number of segments used to approximate a quarter circle.
end_cap_styleintegerThe style of the buffer end caps (1=round, 2=flat, 3=square).
join_styleintegerThe style of the buffer joins (1=round, 2=mitre, 3=bevel).
mitre_limitfloatThe ratio limit for mitered joins.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A geometry representing the buffered area with specific styling.

centroid()

@classmethod
def centroid() - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

The centroid is equal to the centroid of the set of component Geometries of highest dimension (since the lower-dimension geometries contribute zero "weight" to the centroid).

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A Point geometry representing the geometric center.

convex_hull()

@classmethod
def convex_hull() - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Return the smallest convex Polygon that contains all the points in the Geometry.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The convex hull geometry.

difference()

@classmethod
def difference(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Return a Geometry representing the points making up this Geometry that do not make up other.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to subtract from this one.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A geometry representing the spatial difference.

envelope()

@classmethod
def envelope() - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Return the envelope for this geometry (a polygon).

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A polygon representing the bounding box of the geometry.

intersection()

@classmethod
def intersection(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Return a Geometry representing the points shared by this Geometry and other.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to intersect with.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A geometry representing the spatial intersection.

point_on_surface()

@classmethod
def point_on_surface() - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Compute an interior point of this Geometry.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A Point geometry guaranteed to be on the surface of the geometry.

relate()

@classmethod
def relate(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > string

Return the DE-9IM intersection matrix for this Geometry and the other.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to relate to.

Returns

TypeDescription
stringA 9-character string representing the intersection matrix.

simplify()

@classmethod
def simplify(
tolerance: float,
preserve_topology: boolean
) - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Return the Geometry, simplified using the Douglas-Peucker algorithm to the specified tolerance (higher tolerance = > less points). If no tolerance provided, defaults to 0. By default, don't preserve topology - e.g. polygons can be split, collapse to lines or disappear holes can be created or disappear, and lines can cross. By specifying preserve_topology=True, the result will have the same dimension and number of components as the input. This is significantly slower.

Parameters

NameTypeDescription
tolerancefloatThe distance tolerance for simplification.
preserve_topologybooleanIf True, uses a slower algorithm that prevents topological errors.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A simplified version of the geometry.

sym_difference()

@classmethod
def sym_difference(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Return a set combining the points in this Geometry not in other, and the points in other not in this Geometry.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to compare against.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A geometry representing the symmetric difference.

unary_union()

@classmethod
def unary_union() - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Return the union of all the elements of this geometry.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A single geometry representing the union of all components.

union()

@classmethod
def union(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Return a Geometry representing all the points in this Geometry and other.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to union with.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A geometry representing the spatial union.

area()

@classmethod
def area() - > float

Return the area of the Geometry.

Returns

TypeDescription
floatThe area in units of the coordinate system.

distance()

@classmethod
def distance(
other: [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)
) - > float

Return the distance between the closest points on this Geometry and the other. Units will be in those of the coordinate system of the Geometry.

Parameters

NameTypeDescription
other[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)The geometry to measure distance to.

Returns

TypeDescription
floatThe minimum distance between the two geometries.

extent()

@classmethod
def extent() - > tuple

Return the extent of this geometry as a 4-tuple, consisting of (xmin, ymin, xmax, ymax).

Returns

TypeDescription
tupleA 4-tuple of floats representing the bounding box coordinates.

length()

@classmethod
def length() - > float

Return the length of this Geometry (e.g., 0 for point, or the circumference of a Polygon).

Returns

TypeDescription
floatThe length or perimeter of the geometry.

clone()

@classmethod
def clone() - > [GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)

Clone this Geometry.

Returns

TypeDescription
[GEOSGeometry](geosgeometry.md?sid=django_contrib_gis_geos_geometry_geosgeometry)A new GEOSGeometry instance that is an exact copy of this one.