geodatafusion

June 12, 2026 · View on GitHub

Spatial extensions for Apache DataFusion, an extensible query engine written in Rust that uses Apache Arrow as its in-memory format.

Install

Add to your Cargo.toml:

[dependencies]
datafusion = "53.0"
geodatafusion = "0.4"

Functions supported

Functions are explicitly modeled after the PostGIS API. We strive to match the PostGIS API as much as possible.

Geometry Constructors

NameImplementedDescription
ST_CollectCreates a GeometryCollection or Multi* geometry from a set of geometries.
ST_LineFromMultiPointCreates a LineString from a MultiPoint geometry.
ST_MakeEnvelopeCreates a rectangular Polygon from minimum and maximum coordinates.
ST_MakeLineCreates a LineString from Point, MultiPoint, or LineString geometries.
ST_MakePointCreates a 2D, 3DZ or 4D Point.
ST_MakePointMCreates a Point from X, Y and M values.
ST_MakePolygonCreates a Polygon from a shell and optional list of holes.
ST_PointCreates a Point with X, Y and SRID values.
ST_PointZCreates a Point with X, Y, Z and SRID values.
ST_PointMCreates a Point with X, Y, M and SRID values.
ST_PointZMCreates a Point with X, Y, Z, M and SRID values.
ST_PolygonCreates a Polygon from a LineString with a specified SRID.
ST_TileEnvelopeCreates a rectangular Polygon in Web Mercator (SRID:3857) using the XYZ tile system.
ST_HexagonGridReturns a set of hexagons and cell indices that completely cover the bounds of the geometry argument.
ST_HexagonReturns a single hexagon, using the provided edge size and cell coordinate within the hexagon grid space.
ST_SquareGridReturns a set of grid squares and cell indices that completely cover the bounds of the geometry argument.
ST_SquareReturns a single square, using the provided edge size and cell coordinate within the square grid space.
ST_LettersReturns the input letters rendered as geometry with a default start position at the origin and default text height of 100.

Geometry Accessors

NameImplementedDescription
GeometryTypeReturns the type of a geometry as text.
ST_BoundaryReturns the boundary of a geometry.
ST_BoundingDiagonalReturns the diagonal of a geometry's bounding box.
ST_CoordDimReturn the coordinate dimension of a geometry.
ST_DimensionReturns the topological dimension of a geometry.
ST_DumpReturns a set of geometry_dump rows for the components of a geometry.
ST_DumpPointsReturns a set of geometry_dump rows for the coordinates in a geometry.
ST_DumpSegmentsReturns a set of geometry_dump rows for the segments in a geometry.
ST_DumpRingsReturns a set of geometry_dump rows for the exterior and interior rings of a Polygon.
ST_EndPointReturns the last point of a LineString or CircularLineString.
ST_EnvelopeReturns a geometry representing the bounding box of a geometry.
ST_ExteriorRingReturns a LineString representing the exterior ring of a Polygon.
ST_GeometryNReturn an element of a geometry collection.
ST_GeometryTypeReturns the SQL-MM type of a geometry as text.
ST_InteriorRingNReturns the Nth interior ring (hole) of a Polygon.
ST_IsClosedTests if a LineStrings's start and end points are coincident.
ST_IsCollectionTests if a geometry is a geometry collection type.
ST_IsEmptyTests if a geometry is empty.
ST_IsPolygonCCWTests if Polygons have exterior rings oriented counter-clockwise and interior rings oriented clockwise.
ST_IsPolygonCWTests if Polygons have exterior rings oriented clockwise and interior rings oriented counter-clockwise.
ST_IsRingTests if a LineString is closed and simple.
ST_IsSimpleTests if a geometry has no points of self-intersection or self-tangency.
ST_MReturns the M coordinate of a Point.
ST_MemSizeReturns the amount of memory space a geometry takes.
ST_NDimsReturns the coordinate dimension of a geometry.
ST_NPointsReturns the number of points (vertices) in a geometry.
ST_NRingsReturns the number of rings in a polygonal geometry.
ST_NumGeometriesReturns the number of elements in a geometry collection.
ST_NumInteriorRingsReturns the number of interior rings (holes) of a Polygon.
ST_NumInteriorRingReturns the number of interior rings (holes) of a Polygon. Aias for ST_NumInteriorRings
ST_NumPointsReturns the number of points in a LineString or CircularString.
ST_PointNReturns the Nth point in the first LineString or circular LineString in a geometry.
ST_PointsReturns a MultiPoint containing the coordinates of a geometry.
ST_StartPointReturns the first point of a LineString.
ST_SummaryReturns a text summary of the contents of a geometry.
ST_XReturns the X coordinate of a Point.
ST_YReturns the Y coordinate of a Point.
ST_ZReturns the Z coordinate of a Point.
ST_ZmflagReturns a code indicating the ZM coordinate dimension of a geometry.
ST_HasZChecks if a geometry has a Z dimension.
ST_HasMChecks if a geometry has an M (measure) dimension.

Geometry Editors

NameImplementedDescription
ST_AddPointAdd a point to a LineString.
ST_CollectionExtractGiven a geometry collection, returns a multi-geometry containing only elements of a specified type.
ST_CollectionHomogenizeReturns the simplest representation of a geometry collection.
ST_ScrollChange start point of a closed LineString.
ST_FlipCoordinatesReturns a version of a geometry with X and Y axis flipped.
ST_Force2DForce the geometries into a "2-dimensional mode".
ST_Force3DForce the geometries into XYZ mode. This is an alias for ST_Force3DZ.
ST_Force3DZForce the geometries into XYZ mode.
ST_Force3DMForce the geometries into XYM mode.
ST_Force4DForce the geometries into XYZM mode.
ST_ForceCollectionConvert the geometry into a GEOMETRYCOLLECTION.
ST_ForcePolygonCCWOrients all exterior rings counter-clockwise and all interior rings clockwise.
ST_ForcePolygonCWOrients all exterior rings clockwise and all interior rings counter-clockwise.
ST_ForceSFSForce the geometries to use SFS 1.1 geometry types only.
ST_ForceRHRForce the orientation of the vertices in a polygon to follow the Right-Hand-Rule.
ST_LineExtendReturns a line extended forwards and backwards by specified distances.
ST_MultiReturn the geometry as a MULTI* geometry.
ST_NormalizeReturn the geometry in its canonical form.
ST_ProjectReturns a point projected from a start point by a distance and bearing (azimuth).
ST_QuantizeCoordinatesSets least significant bits of coordinates to zero
ST_RemovePointRemove a point from a linestring.
ST_RemoveRepeatedPointsReturns a version of a geometry with duplicate points removed.
ST_RemoveIrrelevantPointsForViewRemoves points that are irrelevant for rendering a specific rectangluar view of a geometry.
ST_RemoveSmallPartsRemoves small parts (polygon rings or linestrings) of a geometry.
ST_ReverseReturn the geometry with vertex order reversed.
ST_SegmentizeReturns a modified geometry/geography having no segment longer than a given distance.
ST_SetPointReplace point of a linestring with a given point.
ST_ShiftLongitudeShifts the longitude coordinates of a geometry between -180..180 and 0..360.
ST_WrapXWrap a geometry around an X value.
ST_SnapToGridSnap all points of the input geometry to a regular grid.
ST_SnapSnap segments and vertices of input geometry to vertices of a reference geometry.
ST_SwapOrdinatesReturns a version of the given geometry with given ordinate values swapped.

Geometry Validation

NameImplementedDescription
ST_IsValidTests if a geometry is well-formed in 2D.
ST_IsValidDetailReturns a valid_detail row stating if a geometry is valid or if not a reason and a location.
ST_IsValidReasonReturns text stating if a geometry is valid, or a reason for invalidity.
ST_MakeValidAttempts to make an invalid geometry valid without losing vertices.

Geometry Input

Well-Known Text (WKT)

NameImplementedDescription
ST_BdPolyFromTextConstruct a Polygon given an arbitrary collection of closed linestrings as a MultiLineString Well-Known text representation.
ST_BdMPolyFromTextConstruct a MultiPolygon given an arbitrary collection of closed linestrings as a MultiLineString text representation Well-Known text representation.
ST_GeomCollFromTextMakes a collection Geometry from collection WKT with the given SRID. If SRID is not given, it defaults to 0.
ST_GeomFromEWKTReturn a specified ST_Geometry value from Extended Well-Known Text representation (EWKT).
ST_GeometryFromTextReturn a specified ST_Geometry value from Well-Known Text representation (WKT). This is an alias name for ST_GeomFromText
ST_GeomFromTextReturn a specified ST_Geometry value from Well-Known Text representation (WKT).
ST_LineFromTextMakes a Geometry from WKT representation with the given SRID. If SRID is not given, it defaults to 0.
ST_MLineFromTextReturn a specified ST_MultiLineString value from WKT representation.
ST_MPointFromTextMakes a Geometry from WKT with the given SRID. If SRID is not given, it defaults to 0.
ST_MPolyFromTextMakes a MultiPolygon Geometry from WKT with the given SRID. If SRID is not given, it defaults to 0.
ST_PointFromTextMakes a point Geometry from WKT with the given SRID. If SRID is not given, it defaults to unknown.
ST_PolygonFromTextMakes a Geometry from WKT with the given SRID. If SRID is not given, it defaults to 0.
ST_WKTToSQLReturn a specified ST_Geometry value from Well-Known Text representation (WKT). This is an alias name for ST_GeomFromText

Well-Known Binary (WKB)

NameImplementedDescription
ST_GeomFromEWKBReturn a specified ST_Geometry value from Extended Well-Known Binary representation (EWKB).
ST_GeomFromWKBCreates a geometry instance from a Well-Known Binary geometry representation (WKB) and optional SRID.
ST_LineFromWKBMakes a LINESTRING from WKB with the given SRID
ST_LinestringFromWKBMakes a geometry from WKB with the given SRID.
ST_PointFromWKBMakes a geometry from WKB with the given SRID
ST_WKBToSQLReturn a specified ST_Geometry value from Well-Known Binary representation (WKB). This is an alias name for ST_GeomFromWKB that takes no srid

Other Formats

NameImplementedDescription
ST_Box2dFromGeoHashReturn a BOX2D from a GeoHash string.
ST_GeomFromGeoHashReturn a geometry from a GeoHash string.
ST_GeomFromGMLTakes as input GML representation of geometry and outputs a PostGIS geometry object
ST_GeomFromGeoJSONTakes as input a geojson representation of a geometry and outputs a PostGIS geometry object
ST_GeomFromKMLTakes as input KML representation of geometry and outputs a PostGIS geometry object
ST_GeomFromTWKBCreates a geometry instance from a TWKB ("Tiny Well-Known Binary") geometry representation.
ST_GMLToSQLReturn a specified ST_Geometry value from GML representation. This is an alias name for ST_GeomFromGML
ST_LineFromEncodedPolylineCreates a LineString from an Encoded Polyline.
ST_PointFromGeoHashReturn a point from a GeoHash string.
ST_FromFlatGeobufToTableCreates a table based on the structure of FlatGeobuf data.
ST_FromFlatGeobufReads FlatGeobuf data.

Geometry Output

Well-Known Text (WKT)

NameImplementedDescription
ST_AsEWKTReturn the Well-Known Text (WKT) representation of the geometry with SRID meta data.
ST_AsTextReturn the Well-Known Text (WKT) representation of the geometry/geography without SRID metadata.

Well-Known Binary (WKB)

NameImplementedDescription
ST_AsBinaryReturn the OGC/ISO Well-Known Binary (WKB) representation of the geometry/geography without SRID meta data.
ST_AsEWKBReturn the Extended Well-Known Binary (EWKB) representation of the geometry with SRID meta data.
ST_AsHEXEWKBReturns a Geometry in HEXEWKB format (as text) using either little-endian (NDR) or big-endian (XDR) encoding.

Other Formats

NameImplementedDescription
ST_AsEncodedPolylineReturns an Encoded Polyline from a LineString geometry.
ST_AsFlatGeobufReturn a FlatGeobuf representation of a set of rows.
ST_AsGeobufReturn a Geobuf representation of a set of rows.
ST_AsGeoJSONReturn a geometry or feature in GeoJSON format.
ST_AsGMLReturn the geometry as a GML version 2 or 3 element.
ST_AsKMLReturn the geometry as a KML element.
ST_AsLatLonTextReturn the Degrees, Minutes, Seconds representation of the given point.
ST_AsMVTGeomTransforms a geometry into the coordinate space of a MVT tile.
ST_AsMVTAggregate function returning a MVT representation of a set of rows.
ST_AsSVGReturns SVG path data for a geometry.
ST_AsTWKBReturns the geometry as TWKB, aka "Tiny Well-Known Binary"
ST_GeoHashReturn a GeoHash representation of the geometry.

Operators

Spatial Relationships

Topological Relationships

NameImplementedDescription
ST_3DIntersectsTests if two geometries spatially intersect in 3D - only for points, linestrings, polygons, polyhedral surface (area).
ST_ContainsTests if every point of B lies in A, and their interiors have a point in common.
ST_ContainsProperlyTests if every point of B lies in the interior of A.
ST_CoveredByTests if every point of A lies in B.
ST_CoversTests if every point of B lies in A.
ST_CrossesTests if two geometries have some, but not all, interior points in common.
ST_DisjointTests if two geometries have no points in common.
ST_EqualsTests if two geometries include the same set of points.
ST_IntersectsTests if two geometries intersect (they have at least one point in common).
ST_LineCrossingDirectionReturns a number indicating the crossing behavior of two LineStrings.
ST_OrderingEqualsTests if two geometries represent the same geometry and have points in the same directional order.
ST_OverlapsTests if two geometries have the same dimension and intersect, but each has at least one point not in the other.
ST_RelateTests if two geometries have a topological relationship matching an Intersection Matrix pattern, or computes their Intersection Matrix.
ST_RelateMatchTests if a DE-9IM Intersection Matrix matches an Intersection Matrix pattern.
ST_TouchesTests if two geometries have at least one point in common, but their interiors do not intersect.
ST_WithinTests if every point of A lies in B, and their interiors have a point in common.

Measurement Functions

NameImplementedDescription
ST_AreaReturns the area of a polygonal geometry.
ST_AzimuthReturns the north-based azimuth of a line between two points.
ST_AngleReturns the angle between two vectors defined by 3 or 4 points, or 2 lines.
ST_ClosestPointReturns the 2D point on g1 that is closest to g2. This is the first point of the shortest line from one geometry to the other.
ST_3DClosestPointReturns the 3D point on g1 that is closest to g2. This is the first point of the 3D shortest line.
ST_DistanceReturns the distance between two geometry or geography values.
ST_3DDistanceReturns the 3D cartesian minimum distance (based on spatial ref) between two geometries in projected units.
ST_DistanceSphereReturns minimum distance in meters between two lon/lat geometries using a spherical earth model.
ST_DistanceSpheroidReturns the minimum distance between two lon/lat geometries using a spheroidal earth model.
ST_FrechetDistanceReturns the Fréchet distance between two geometries.
ST_HausdorffDistanceReturns the Hausdorff distance between two geometries.
ST_LengthReturns the 2D length of a linear geometry.
ST_Length2DReturns the 2D length of a linear geometry. Alias for ST_Length
ST_3DLengthReturns the 3D length of a linear geometry.
ST_LengthSpheroidReturns the 2D or 3D length/perimeter of a lon/lat geometry on a spheroid.
ST_LongestLineReturns the 2D longest line between two geometries.
ST_3DLongestLineReturns the 3D longest line between two geometries
ST_MaxDistanceReturns the 2D largest distance between two geometries in projected units.
ST_3DMaxDistanceReturns the 3D cartesian maximum distance (based on spatial ref) between two geometries in projected units.
ST_MinimumClearanceReturns the minimum clearance of a geometry, a measure of a geometry's robustness.
ST_MinimumClearanceLineReturns the two-point LineString spanning a geometry's minimum clearance.
ST_PerimeterReturns the length of the boundary of a polygonal geometry or geography.
ST_Perimeter2DReturns the 2D perimeter of a polygonal geometry. Alias for ST_Perimeter.
ST_3DPerimeterReturns the 3D perimeter of a polygonal geometry.
ST_ShortestLineReturns the 2D shortest line between two geometries
ST_3DShortestLineReturns the 3D shortest line between two geometries

Overlay Functions

NameImplementedDescription
ST_ClipByBox2DComputes the portion of a geometry falling within a rectangle.
ST_DifferenceComputes a geometry representing the part of geometry A that does not intersect geometry B.
ST_IntersectionComputes a geometry representing the shared portion of geometries A and B.
ST_MemUnionAggregate function which unions geometries in a memory-efficent but slower way
ST_NodeNodes a collection of lines.
ST_SplitReturns a collection of geometries created by splitting a geometry by another geometry.
ST_SubdivideComputes a rectilinear subdivision of a geometry.
ST_SymDifferenceComputes a geometry representing the portions of geometries A and B that do not intersect.
ST_UnaryUnionComputes the union of the components of a single geometry.
ST_UnionComputes a geometry representing the point-set union of the input geometries.

Geometry Processing

NameImplementedDescription
ST_BufferComputes a geometry covering all points within a given distance from a geometry.
ST_BuildAreaCreates a polygonal geometry formed by the linework of a geometry.
ST_CentroidReturns the geometric center of a geometry.
ST_ChaikinSmoothingReturns a smoothed version of a geometry, using the Chaikin algorithm
ST_ConcaveHullComputes a possibly concave geometry that contains all input geometry vertices
ST_ConvexHullComputes the convex hull of a geometry.
ST_DelaunayTrianglesReturns the Delaunay triangulation of the vertices of a geometry.
ST_FilterByMRemoves vertices based on their M value
ST_GeneratePointsGenerates a multipoint of random points contained in a Polygon or MultiPolygon.
ST_GeometricMedianReturns the geometric median of a MultiPoint.
ST_LineMergeReturn the lines formed by sewing together a MultiLineString.
ST_MaximumInscribedCircleComputes the largest circle contained within a geometry.
ST_LargestEmptyCircleComputes the largest circle not overlapping a geometry.
ST_MinimumBoundingCircleReturns the smallest circle polygon that contains a geometry.
ST_MinimumBoundingRadiusReturns the center point and radius of the smallest circle that contains a geometry.
ST_OrientedEnvelopeReturns a minimum-area rectangle containing a geometry.
ST_OffsetCurveReturns an offset line at a given distance and side from an input line.
ST_PointOnSurfaceComputes a point guaranteed to lie in a polygon, or on a geometry.
ST_PolygonizeComputes a collection of polygons formed from the linework of a set of geometries.
ST_ReducePrecisionReturns a valid geometry with points rounded to a grid tolerance.
ST_SharedPathsReturns a collection containing paths shared by the two input linestrings/multilinestrings.
ST_SimplifyReturns a simplified representation of a geometry, using the Douglas-Peucker algorithm.
ST_SimplifyPreserveTopologyReturns a simplified and valid representation of a geometry, using the Douglas-Peucker algorithm.
ST_SimplifyPolygonHullComputes a simplifed topology-preserving outer or inner hull of a polygonal geometry.
ST_SimplifyVWReturns a simplified representation of a geometry, using the Visvalingam-Whyatt algorithm
ST_SetEffectiveAreaSets the effective area for each vertex, using the Visvalingam-Whyatt algorithm.
ST_TriangulatePolygonComputes the constrained Delaunay triangulation of polygons
ST_VoronoiLinesReturns the boundaries of the Voronoi diagram of the vertices of a geometry.
ST_VoronoiPolygonsReturns the cells of the Voronoi diagram of the vertices of a geometry.

Coverages

NameImplementedDescription
ST_CoverageInvalidEdgesWindow function that finds locations where polygons fail to form a valid coverage.
ST_CoverageSimplifyWindow function that simplifies the edges of a polygonal coverage.
ST_CoverageUnionComputes the union of a set of polygons forming a coverage by removing shared edges.

Affine Transformations

NameImplementedDescription
ST_AffineApply a 3D affine transformation to a geometry.
ST_RotateRotates a geometry about an origin point.
ST_RotateXRotates a geometry about the X axis.
ST_RotateYRotates a geometry about the Y axis.
ST_RotateZRotates a geometry about the Z axis.
ST_ScaleScales a geometry by given factors.
ST_TranslateTranslates a geometry by given offsets.
ST_TransScaleTranslates and scales a geometry by given offsets and factors.

Clustering Functions

NameImplementedDescription
ST_ClusterDBSCANWindow function that returns a cluster id for each input geometry using the DBSCAN algorithm.
ST_ClusterIntersectingAggregate function that clusters input geometries into connected sets.
ST_ClusterIntersectingWinWindow function that returns a cluster id for each input geometry, clustering input geometries into connected sets.
ST_ClusterKMeansWindow function that returns a cluster id for each input geometry using the K-means algorithm.
ST_ClusterWithinAggregate function that clusters geometries by separation distance.
ST_ClusterWithinWinWindow function that returns a cluster id for each input geometry, clustering using separation distance.

Bounding Box Functions

NameImplementedDescription
Box2DReturns a BOX2D representing the 2D extent of a geometry.
Box3DReturns a BOX3D representing the 3D extent of a geometry.
ST_EstimatedExtentReturns the estimated extent of a spatial table.
ST_ExpandReturns a bounding box expanded from another bounding box or a geometry.
ST_ExtentAggregate function that returns the bounding box of geometries.
ST_3DExtentAggregate function that returns the 3D bounding box of geometries.
ST_MakeBox2DCreates a BOX2D defined by two 2D point geometries.
ST_3DMakeBoxCreates a BOX3D defined by two 3D point geometries.
ST_XMaxReturns the X maxima of a 2D or 3D bounding box or a geometry.
ST_XMinReturns the X minima of a 2D or 3D bounding box or a geometry.
ST_YMaxReturns the Y maxima of a 2D or 3D bounding box or a geometry.
ST_YMinReturns the Y minima of a 2D or 3D bounding box or a geometry.
ST_ZMaxReturns the Z maxima of a 2D or 3D bounding box or a geometry.
ST_ZMinReturns the Z minima of a 2D or 3D bounding box or a geometry.

Linear Referencing

NameImplementedDescription
ST_LineInterpolatePointReturns a point interpolated along a line at a fractional location.
ST_3DLineInterpolatePointReturns a point interpolated along a 3D line at a fractional location.
ST_LineInterpolatePointsReturns points interpolated along a line at a fractional interval.
ST_LineLocatePointReturns the fractional location of the closest point on a line to a point.
ST_LineSubstringReturns the part of a line between two fractional locations.
ST_LocateAlongReturns the point(s) on a geometry that match a measure value.
ST_LocateBetweenReturns the portions of a geometry that match a measure range.
ST_LocateBetweenElevationsReturns the portions of a geometry that lie in an elevation (Z) range.
ST_InterpolatePointReturns the interpolated measure of a geometry closest to a point.
ST_AddMeasureInterpolates measures along a linear geometry.