GIS Functions
Reference
PostGIS, Turf.js, and GDAL functions — syntax, examples, and when to use each.
Box2D
Returns a 2D bounding box of type box2d that tightly encloses the given geometry.
Box3D
Returns a 3D bounding box of type box3d enclosing a geometry, including its Z values when present.
gdal_calc
Evaluates NumPy expressions across raster bands, the command-line raster calculator for band math and thresholding.
gdal_contour
Generates vector contour lines or polygons from a raster elevation or continuous-value dataset.
gdal_edit
Edits raster georeferencing, CRS, NoData, and metadata in place without rewriting pixel data.
gdal_fillnodata
Fills NoData pixels in a raster by interpolating from surrounding valid pixels, closing gaps in DEMs and imagery.
gdal_grid
Interpolates scattered point data into a regular raster grid using IDW, moving average, nearest neighbour, and other methods.
gdal_merge
Mosaics multiple rasters into a single output file or stacks them as separate bands, a simpler alternative to gdalwarp for matching grids.
gdal_polygonize
Converts connected regions of same-valued raster pixels into vector polygons, the raster-to-vector counterpart of gdal_rasterize.
gdal_proximity
Computes a raster of pixel-wise distances from each cell to the nearest target pixel in a source raster.
gdal_rasterize
Burns vector geometries into a raster, either creating a new raster or updating bands in an existing one.
gdal_retile
Retiles a set of rasters into fixed-size tiles, optionally building a pyramid of downsampled tile sets for serving.
gdal_sieve
Removes small connected pixel regions from a classified raster by merging them into the largest adjacent neighbour.
gdal_translate
Converts raster datasets between formats and performs subsetting, band selection, type casting, and value rescaling.
gdal_viewshed
Computes a binary or intensity viewshed raster from a DEM, identifying which cells are visible from a given observer point.
gdaladdo
Builds overview pyramids on raster datasets so viewers and warp operations can read downsampled levels quickly.
gdalbuildvrt
Builds a virtual raster (VRT) that stitches multiple input rasters into a single logical dataset without duplicating pixels.
gdalchecksum
Computes a per-band checksum of a raster dataset, providing a compact fingerprint for integrity and regression checks.
gdalcompare
Reports structural, metadata, and pixel-level differences between two raster datasets for QA and regression testing.
gdaldem
Generates hillshade, slope, aspect, colour-relief, TRI, TPI, and roughness rasters from a digital elevation model.
gdalinfo
Reports size, projection, band statistics, metadata, and geotransform details for any raster dataset GDAL can read.
gdallocationinfo
Reports pixel values and location metadata at a given geographic or pixel coordinate in a raster dataset.
gdalmanage
Identifies, copies, renames, and deletes raster datasets safely using GDAL drivers that understand multi-file formats.
gdalmdiminfo
Reports the structure of a multidimensional raster dataset (groups, arrays, dimensions, attributes) for NetCDF, HDF5, and Zarr.
gdalmdimtranslate
Converts and subsets multidimensional rasters (NetCDF, HDF5, Zarr), extracting arrays or dimension slices into new datasets.
gdalmove
Transforms the georeferencing of a raster to a new CRS without resampling pixels, suitable for approximate reprojection of small-area imagery.
gdalsrsinfo
Reports a coordinate reference system in multiple formats (WKT, PROJ, EPSG) given a raster, vector, or CRS definition.
gdaltindex
Builds a vector tile index from a set of raster files, recording each tile's footprint and path for use as a raster catalog.
gdaltransform
Transforms coordinates between CRSes, using GCPs, or via a geotransform, reading pairs from stdin for scripted conversion.
gdalwarp
Reprojects, warps, mosaics, clips, and resamples raster datasets from the command line.
GeometryType
Returns the geometry type of a PostGIS geometry as an uppercase string, without Z/M suffixes.
nearblack
Converts near-black or near-white collar pixels around imagery into exact black/white or NoData values for clean mosaicking.
ogr2ogr
Converts vector datasets between formats, reprojects, filters, and transforms features using OGR drivers and SQL.
ogrinfo
Reports layers, schemas, feature counts, CRS, and attribute data from any OGR-readable vector dataset.
ogrlineref
Performs linear referencing operations on line features, creating measure-parts layers and locating points or segments along a route.
ogrmerge
Merges multiple vector datasets into a single output, either as separate layers or as one unified layer with source tracking.
ogrtindex
Builds a vector tile index from a set of OGR-readable vector files, storing each input's footprint and path as a catalog.
postgis_srs
Returns a metadata row describing a given authority code, using PROJ's SRS database. Available from PostGIS 3.4.
postgis_srs_all
Returns a set of all SRS metadata rows known to PROJ. Available from PostGIS 3.4.
postgis_srs_codes
Returns the list of SRS codes PROJ knows about for a given authority. Available from PostGIS 3.4.
postgis_srs_search
Returns candidate SRSs whose area of use intersects a given bounds geometry. Available from PostGIS 3.4.
ST_3DClosestPoint
Returns the 3D point on the first geometry that is closest to the second geometry, using Z coordinates.
ST_3DDFullyWithin
Returns true if every point of two geometries is within a given 3D distance of the other.
ST_3DDistance
Returns the minimum 3D Cartesian distance between two geometries, using Z coordinates.
ST_3DDWithin
Returns true if two geometries are within a given 3D distance of each other, using Z coordinates and an N-D GiST index.
ST_3DExtent
Aggregate function that returns the 3D bounding box covering every geometry in the input set, including Z.
ST_3DIntersects
Returns true if two geometries share any portion of space in three dimensions, considering Z coordinates.
ST_3DLength
Returns the 3D length of a linear geometry, including Z coordinate contributions.
ST_3DLineInterpolatePoint
Returns a 3D point interpolated along a 3D linestring at a fractional distance using 3D length.
ST_3DLongestLine
Returns the 3D longest line between two geometries as a two-point LINESTRING using Z coordinates.
ST_3DMakeBox
Constructs a 3D box3d from two corner points, preserving Z values.
ST_3DMaxDistance
Returns the 3D maximum distance between two geometries using Z coordinates.
ST_3DPerimeter
Returns the 3D perimeter of a polygonal geometry, including Z coordinate contributions.
ST_3DShortestLine
Returns the 3D shortest LINESTRING between two geometries using Z coordinates.
ST_AddMeasure
Adds interpolated M (measure) values to a linestring between a starting and ending measure.
ST_AddPoint
Adds a point to a LineString at a specified position, or appends it when no position is given.
ST_Affine
Applies a 3D affine transformation to a geometry using the supplied matrix coefficients.
ST_Angle
Returns the angle in radians between three points or between two vectors defined by two line segments.
ST_Area
Returns the area of a polygonal geometry, using CRS units for geometry input and square metres for geography input.
ST_Azimuth
Returns the north-based azimuth in radians between two points, for geometry or geography input.
ST_BdMPolyFromText
Constructs a MultiPolygon from an arbitrary collection of closed LineStrings given as MultiLineString WKT.
ST_BdPolyFromText
Constructs a Polygon from an arbitrary collection of closed LineStrings given as MultiLineString WKT.
ST_Boundary
Returns the topological boundary of a geometry as defined by OGC, one dimension lower than the input.
ST_BoundingDiagonal
Returns the diagonal of a geometry's bounding box as a two-point LineString from min corner to max corner.
ST_Box2dFromGeoHash
Returns a Box2D corresponding to the area represented by a GeoHash string.
ST_Buffer
Returns a geometry covering all points within a given distance from the input geometry.
ST_BuildArea
Creates an areal geometry from the constituent linework of the input geometry, forming polygons that respect holes and nested rings.
ST_Centroid
Returns the geometric centre (centroid) of a geometry — the mean position of all points weighted by dimension.
ST_ChaikinSmoothing
Smooths a geometry using Chaikin's corner-cutting algorithm, producing visually softer lines and polygons.
ST_ClipByBox2D
Returns the portion of a geometry falling inside a 2D bounding box, using a fast clipping algorithm.
ST_ClosestPoint
Returns the 2D point on the first geometry that is closest to the second geometry.
ST_ClosestPointOfApproach
Returns the M value (time) at which two trajectories are closest to each other in 3D.
ST_ClusterDBSCAN
Window function that assigns a DBSCAN cluster id to each geometry based on a distance threshold and minimum points.
ST_ClusterIntersecting
Aggregate function that clusters input geometries into groups that share at least one intersecting geometry.
ST_ClusterIntersectingWin
Window function that assigns each geometry a cluster id based on transitive intersection with neighbouring geometries.
ST_ClusterKMeans
Window function that partitions geometries into k clusters using the K-Means algorithm with optional weights.
ST_ClusterWithin
Aggregate function that clusters input geometries into groups where every member is within a given distance of at least one other.
ST_ClusterWithinWin
Window function that assigns each geometry a cluster id based on single-linkage clustering within a distance threshold.
ST_Collect
Returns a GeometryCollection or Multi* geometry built from a set of input geometries without merging or dissolving them.
ST_CollectionExtract
Returns only the components of a specified type from a GeometryCollection, as a Multi-geometry.
ST_CollectionHomogenize
Returns the simplest representation of a geometry collection, collapsing single-type collections to Multi or single geometries.
ST_ConcaveHull
Returns a concave hull polygon that tightly wraps the input geometry, controlled by a target percentage parameter.
ST_Contains
Returns true when geometry A completely contains geometry B, with no part of B lying outside A.
ST_ContainsProperly
Returns true when every point of geometry B lies in the interior of geometry A, with no boundary contact.
ST_ConvexHull
Returns the convex hull of a geometry — the smallest convex polygon that contains all input points.
ST_CoordDim
Returns the coordinate dimension of a geometry (2, 3, or 4), counting X, Y, optional Z, and optional M.
ST_CoverageInvalidEdges
Window function that returns the edges of a polygonal coverage that violate validity rules (gaps or overlaps).
ST_CoverageSimplify
Window function that simplifies a polygonal coverage while preserving shared borders between adjacent polygons.
ST_CoverageUnion
Efficiently unions a set of polygons that form a valid coverage, leveraging their topological alignment for speed.
ST_CoveredBy
Returns true when no point of geometry A lies outside geometry B, including when A sits on B's boundary.
ST_Covers
Returns true when no point of geometry B lies outside geometry A, including when B touches A's boundary.
ST_CPAWithin
Returns true when two trajectories come within a specified distance of each other at their closest point of approach.
ST_Crosses
Returns true when two geometries share some but not all interior points and their intersection has lower dimension than at least one input.
ST_CurveToLine
Converts a curved geometry to a LineString approximation with configurable tolerance.
ST_DelaunayTriangles
Computes a Delaunay triangulation of the input vertices, returned as a collection of triangles or edges.
ST_DFullyWithin
Returns true if every point of two geometries is within a given distance of the other — based on maximum distance.
ST_Difference
Returns the part of one geometry that does not intersect another — the set-theoretic difference.
ST_Dimension
Returns the topological dimension of a geometry — 0 for points, 1 for lines, 2 for polygons.
ST_Disjoint
Returns true when two geometries have no points in common — the exact logical negation of ST_Intersects.
ST_Distance
Returns the minimum 2D distance between two geometries, in CRS units for geometry and metres for geography.
ST_DistanceCPA
Returns the minimum 3D distance achieved by two trajectories at their closest point of approach.
ST_DistanceSphere
Returns the minimum great-circle distance in metres between two lon/lat geometries on a sphere.
ST_DistanceSpheroid
Returns the minimum distance in metres between two lon/lat geometries on a specified reference spheroid.
ST_Dump
Set-returning function that decomposes a geometry into its component simple geometries, returning one row per part.
ST_DumpPoints
Set-returning function that returns every vertex of a geometry as an individual Point with its path.
ST_DumpRings
Set-returning function that returns each ring (exterior plus holes) of a Polygon as a separate single-ring Polygon.
ST_DumpSegments
Set-returning function that emits each line segment of a geometry as an individual two-point LineString; added in PostGIS 3.2.
ST_DWithin
Returns true if two geometries are within a given distance — index-accelerated and the right filter for proximity joins.
ST_EndPoint
Returns the last Point of a LineString; NULL for non-LineString inputs in most PostGIS versions.
ST_Envelope
Returns the minimum axis-aligned bounding box of a geometry as a Polygon.
ST_Equals
Returns true when two geometries are spatially equal — the same set of points, regardless of vertex order or representation.
ST_EstimatedExtent
Returns an approximate 2D extent of a geometry column based on PostgreSQL table statistics.
ST_Expand
Returns a bounding box expanded outward by a fixed distance in each direction — cheaper than ST_Buffer for index-time filters.
ST_Extent
Aggregate function that returns the 2D bounding box covering every geometry in the input set.
ST_ExteriorRing
Returns the outer shell of a Polygon as a closed LineString; NULL for non-Polygon inputs.
ST_FilterByM
Filters vertices of a geometry by M-value, keeping only those whose measure lies within the supplied range.
ST_FlipCoordinates
Returns a geometry with the X and Y axes flipped, fixing data loaded in lat/lon order.
ST_Force2D
Forces a geometry into 2D mode, removing any Z and M coordinates.
ST_Force3D
Forces a geometry into XYZ mode. Alias for ST_Force3DZ that sets Z to 0 or a user-supplied value.
ST_Force3DM
Forces a geometry into XYM mode, adding M = 0 (or a supplied value) and dropping any Z ordinates.
ST_Force3DZ
Forces a geometry into XYZ mode, adding Z = 0 (or a supplied value) to any 2D vertices.
ST_Force4D
Forces a geometry into XYZM mode, adding Z and M defaults (or user-supplied values) to missing ordinates.
ST_ForceCollection
Wraps any geometry in a GeometryCollection, producing a single-element collection for non-collection inputs.
ST_ForceCurve
Upcasts a straight geometry to its curve-enabled equivalent type.
ST_ForcePolygonCCW
Forces polygon exteriors to be counter-clockwise and interiors (holes) to be clockwise.
ST_ForcePolygonCW
Forces polygon exteriors to be clockwise and interiors (holes) to be counter-clockwise.
ST_ForceRHR
Forces polygon orientation to follow the right-hand rule (exterior rings clockwise).
ST_ForceSFS
Downcasts a geometry to OGC Simple Features compliance, removing curves and higher dimensions.
ST_FrechetDistance
Returns the Frechet distance between two geometries, a shape-similarity metric accounting for point ordering.
ST_GeneratePoints
Generates a multipoint of pseudo-random points distributed uniformly inside a polygon or multipolygon.
ST_GeogFromText
Constructs a geography value from a well-known text (WKT) or extended WKT representation.
ST_GeogFromWKB
Constructs a geography value from a well-known binary (WKB) or extended WKB input.
ST_GeographyFromText
Constructs a geography value from a well-known text (WKT) or extended WKT representation.
ST_GeomCollFromText
Constructs a GeometryCollection from WKT, optionally with an SRID.
ST_GeometricMedian
Returns the geometric median of a MultiPoint — the point minimising the sum of distances to all input points.
ST_GeometryFromText
OGC-compliant alias of ST_GeomFromText — constructs a geometry from a WKT string.
ST_GeometryN
Returns the Nth component geometry of a Multi* or GeometryCollection, or the geometry itself if single.
ST_GeometryType
Returns the SQL/MM-style geometry type of a PostGIS geometry as a string prefixed with ST_.
ST_GeomFromEWKB
Constructs a geometry from a PostGIS-extended WKB byte string that includes SRID and Z/M data.
ST_GeomFromEWKT
Constructs a geometry from extended WKT (EWKT), which supports SRID prefixes and Z/M ordinates.
ST_GeomFromGeoHash
Returns a polygon geometry for the cell represented by a GeoHash string.
ST_GeomFromGeoJSON
Constructs a PostGIS geometry from a GeoJSON geometry representation.
ST_GeomFromGML
Constructs a PostGIS geometry from a GML (Geography Markup Language) XML representation.
ST_GeomFromKML
Constructs a PostGIS geometry from a KML XML representation in WGS84.
ST_GeomFromMARC21
Constructs a PostGIS geometry from a MARC21/XML bibliographic record's geographic data. Available from PostGIS 3.3.
ST_GeomFromText
Constructs a geometry from a well-known text (WKT) string with an optional SRID.
ST_GeomFromTWKB
Constructs a geometry from Tiny WKB (TWKB), a compact binary encoding for geometry.
ST_GeomFromWKB
Constructs a geometry from a well-known binary (WKB) byte string, optionally with an SRID.
ST_GMLToSQL
SQL/MM alias of ST_GeomFromGML — constructs a geometry from GML text.
ST_HasArc
Returns true if the geometry contains a circular-arc component (CircularString, CurvePolygon, or CompoundCurve).
ST_HausdorffDistance
Returns the Hausdorff distance between two geometries, a shape-similarity metric.
ST_Hexagon
Returns a single hexagon polygon at the given grid coordinate and size; added in PostGIS 3.1.
ST_HexagonGrid
Set-returning function that produces a tessellated hexagon grid covering a geometry's bounding box; added in PostGIS 3.1.
ST_InteriorRingN
Returns the Nth interior ring (hole) of a Polygon as a closed LineString; NULL for non-Polygon inputs.
ST_InterpolatePoint
Returns the interpolated measure (M) of a point when projected onto a measure-parameterised linestring.
ST_Intersection
Returns the shared portion of two geometries — the set-theoretic intersection.
ST_Intersects
Returns true when two geometries share any portion of space — the most commonly used spatial predicate in PostGIS.
ST_InverseTransformPipeline
Applies the inverse of a PROJ coordinate transformation pipeline to a geometry. Available from PostGIS 3.4.
ST_IsClosed
Returns true if a LineString or MultiLineString is closed — i.e. start and end points coincide.
ST_IsCollection
Returns true if the geometry is a collection type (Multi* or GeometryCollection) regardless of how many components it has.
ST_IsEmpty
Returns true if a geometry is empty (has no coordinates), regardless of its type.
ST_IsPolygonCCW
Returns true if the exterior ring of a Polygon is oriented counter-clockwise and interior rings are clockwise.
ST_IsPolygonCW
Returns true if the exterior ring of a Polygon is oriented clockwise and interior rings are counter-clockwise.
ST_IsRing
Returns true if a LineString is both closed (start equals end) and simple (non-self-intersecting).
ST_IsSimple
Returns true if a geometry has no anomalous geometric points such as self-intersections or self-tangency.
ST_IsValid
Tests whether a geometry is well-formed and simple according to the OGC Simple Features specification.
ST_IsValidDetail
Returns a composite row detailing whether a geometry is valid, the reason if not, and a location point.
ST_IsValidReason
Returns a text string with the reason why a geometry is invalid, or "Valid Geometry" if valid.
ST_IsValidTrajectory
Returns true when a measured linestring is a valid trajectory — that is, its M values are strictly increasing.
ST_LargestEmptyCircle
Returns the largest circle containing none of the input geometry's obstacles, optionally bounded by a boundary polygon.
ST_Length
Returns the 2D length of a linear geometry, in CRS units for geometry and metres for geography.
ST_Length2D
Returns the 2D length of a linear geometry; alias of ST_Length for geometry input.
ST_LengthSpheroid
Returns the 2D or 3D length of a lon/lat geometry measured on a specified reference spheroid.
ST_Letters
Returns a geometry representing rendered text letters using the default Unicode font; added in PostGIS 3.3.
ST_LineCrossingDirection
Returns an integer encoding how two linestrings cross — no crossing, left, right, or multi-cross.
ST_LineExtend
Extends a LineString at its endpoints by a specified distance, in CRS units. Available from PostGIS 3.4.
ST_LineFromEncodedPolyline
Constructs a LineString from a Google encoded polyline string.
ST_LineFromMultiPoint
Creates a LineString from a MultiPoint geometry by connecting its points in order.
ST_LineFromText
Constructs a LineString from WKT, raising an error if the WKT is not a LineString.
ST_LineFromWKB
Constructs a LineString from WKB, raising an error if the WKB is not a LineString.
ST_LineInterpolatePoint
Returns a point interpolated along a linestring at a fractional distance between 0 and 1.
ST_LineInterpolatePoints
Returns multiple points interpolated along a linestring at regular fractional intervals.
ST_LineLocatePoint
Returns the fractional position of the closest point on a linestring to a given point.
ST_LineMerge
Stitches connected lines in a MultiLineString into the longest possible LineStrings by joining shared endpoints.
ST_LinestringFromWKB
Alias of ST_LineFromWKB — constructs a LineString from WKB.
ST_LineSubstring
Returns the portion of a linestring between two fractional positions.
ST_LineToCurve
Detects circular arcs in a LineString and rebuilds it as a CircularString, CompoundCurve, or CurvePolygon.
ST_LocateAlong
Returns the locations along a measure-parameterised geometry where a specified M value occurs.
ST_LocateBetween
Returns the portions of a measure-parameterised geometry that fall between two measure values.
ST_LocateBetweenElevations
Returns the portions of a geometry whose Z values fall between two elevation bounds.
ST_LongestLine
Returns the 2D longest line between two geometries as a two-point LINESTRING.
ST_M
Returns the M (measure) coordinate of a Point geometry, or NULL if absent.
ST_MakeBox2D
Constructs a 2D box2d from two corner points.
ST_MakeEnvelope
Constructs a rectangular Polygon from minimum and maximum X/Y coordinates and an optional SRID.
ST_MakeLine
Builds a LineString from two points, an array of points, or an aggregated ordered set of point geometries.
ST_MakePoint
Creates a 2D, 3D, or 4D Point geometry from numeric coordinates; returns SRID=0 unless set explicitly.
ST_MakePointM
Creates a Point with X, Y, and an M (measure) coordinate but no Z value.
ST_MakePolygon
Creates a Polygon from a closed LineString outer shell and an optional array of inner-ring holes.
ST_MakeValid
Attempts to repair invalid geometry, returning a valid geometry that preserves the input's vertices.
ST_MaxDistance
Returns the 2D maximum distance between two geometries in projected CRS units.
ST_MaximumInscribedCircle
Returns the largest circle that fits entirely inside a polygon, together with its centre point and radius.
ST_MemSize
Returns the total in-memory byte size of a geometry including headers and bounding box.
ST_MemUnion
Memory-frugal aggregate that unions geometries one at a time, trading speed for lower memory usage.
ST_MinimumBoundingCircle
Returns the smallest circle containing the input geometry, approximated as a polygon.
ST_MinimumBoundingRadius
Returns the centre point and radius of the smallest circle containing the input geometry.
ST_MinimumClearance
Returns the minimum clearance of a geometry, a measure of its robustness to coordinate perturbation.
ST_MinimumClearanceLine
Returns the two-point LINESTRING spanning a geometry's minimum clearance, showing the at-risk vertex and segment.
ST_MLineFromText
Constructs a MultiLineString from WKT, raising an error if the WKT is not a MultiLineString.
ST_MPointFromText
Constructs a MultiPoint from WKT, raising an error if the WKT is not a MultiPoint.
ST_MPolyFromText
Constructs a MultiPolygon from WKT, raising an error if the WKT is not a MultiPolygon.
ST_Multi
Returns the geometry as a MULTI-geometry type (MultiPoint, MultiLineString, or MultiPolygon).
ST_NDims
Returns the coordinate dimension (2, 3, or 4) of a geometry, counting X, Y, optional Z, and optional M.
ST_Node
Nodes a set of linestrings by splitting them at all intersection points, producing a noded MULTILINESTRING.
ST_Normalize
Returns the canonical form of a geometry, useful for comparing geometries by value.
ST_NPoints
Returns the total number of points (vertices) in a geometry across all parts and rings.
ST_NRings
Returns the total number of rings (exterior plus all interiors) across all parts of a Polygon or MultiPolygon.
ST_NumGeometries
Returns the number of component geometries in a Multi* or GeometryCollection; 1 for simple geometries.
ST_NumInteriorRing
Alias of ST_NumInteriorRings; returns the number of interior rings (holes) in a Polygon.
ST_NumInteriorRings
Returns the number of interior rings (holes) in a single Polygon; NULL for non-Polygon inputs.
ST_NumPatches
Returns the number of patches (faces) in a PolyhedralSurface or TIN geometry.
ST_NumPoints
Returns the number of points in a LineString or CircularString; NULL for other geometry types.
ST_OffsetCurve
Returns a line parallel to the input at a signed distance, with configurable join, quad_segs, and mitre limit.
ST_OrderingEquals
Returns true when two geometries are identical and their points are stored in the same order.
ST_OrientedEnvelope
Returns the minimum-area rotated bounding rectangle that contains the input geometry.
ST_Overlaps
Returns true when two geometries of the same dimension partially overlap but neither contains the other.
ST_PatchN
Returns the Nth patch of a PolyhedralSurface or TIN geometry as a Polygon; 1-based index.
ST_Perimeter
Returns the 2D perimeter of a polygonal geometry; in CRS units for geometry and metres for geography.
ST_Perimeter2D
Returns the 2D perimeter of a polygonal geometry; alias of ST_Perimeter for geometry input.
ST_Point
Creates a 2D Point from X and Y coordinates with an optional SRID argument; preferred modern constructor in PostGIS 3.2+.
ST_PointFromGeoHash
Returns the centre point of the GeoHash cell represented by the input string.
ST_PointFromText
Constructs a Point from WKT, raising an error if the WKT is not a Point.
ST_PointFromWKB
Constructs a Point from WKB, raising an error if the WKB is not a Point.
ST_PointInsideCircle
Returns true if a POINT geometry lies inside a circle defined by centre coordinates and a radius.
ST_PointM
Creates a Point with X, Y, and M (measure) coordinates and an explicit SRID; available in PostGIS 3.2+.
ST_PointN
Returns the Nth point of a LineString or CircularString as a Point; supports negative indices.
ST_PointOnSurface
Returns a point guaranteed to lie inside the input polygon or on the input geometry.
ST_Points
Returns a MultiPoint containing every vertex of the input geometry, including duplicates.
ST_PointZ
Creates a 3D Point with X, Y, Z coordinates and an explicit SRID; available in PostGIS 3.2+.
ST_PointZM
Creates a 4D Point with X, Y, Z, M coordinates and an explicit SRID; available in PostGIS 3.2+.
ST_Polygon
Creates a simple Polygon from a closed LineString and an explicit SRID; does not accept interior holes.
ST_PolygonFromText
Constructs a Polygon from WKT, raising an error if the WKT is not a Polygon.
ST_Polygonize
Aggregates linework into every polygonal face that can be formed, returning a GeometryCollection of polygons.
ST_Project
Returns a point projected from a start point by a distance and azimuth. Geography from PostGIS 2.4; geometry from 3.4.
ST_QuantizeCoordinates
Sets trailing bits of coordinate mantissas to zero to improve compression, without creating invalid geometry.
ST_ReducePrecision
Snaps vertices to a precision grid while preserving validity, using GEOS's topology-preserving precision reducer.
ST_Relate
Tests or returns the Dimensionally Extended 9-Intersection Model matrix describing how two geometries relate topologically.
ST_RelateMatch
Returns true if a DE-9IM intersection matrix satisfies a given intersection matrix pattern.
ST_RemovePoint
Removes a point from a LineString at the specified zero-based vertex index.
ST_RemoveRepeatedPoints
Removes duplicate consecutive vertices from a geometry, optionally within a tolerance.
ST_Reverse
Returns a geometry with its vertex order reversed.
ST_Rotate
Rotates a geometry counter-clockwise about a specified origin by the given angle in radians.
ST_RotateX
Rotates a geometry about the X axis by the given angle in radians, affecting Y and Z coordinates.
ST_RotateY
Rotates a geometry about the Y axis by the given angle in radians, affecting X and Z coordinates.
ST_RotateZ
Rotates a geometry about the Z axis by the given angle in radians — equivalent to 2D rotation about the origin.
ST_Scale
Scales a geometry by factors along the X, Y, and optionally Z axes, optionally about a supplied origin.
ST_Scroll
Changes the start/end point of a closed LineString to the specified point. Available from PostGIS 3.2.
ST_Segmentize
Returns a modified geometry having no segment longer than the given distance.
ST_SetEffectiveArea
Stores each vertex's Visvalingam-Whyatt effective area as its M-value, enabling progressive simplification.
ST_SetPoint
Replaces the point at the specified zero-based index of a LineString with a new point.
ST_SetSRID
Sets the SRID of a geometry without reprojecting its coordinates.
ST_SharedPaths
Returns the collection of shared edges between two line or multiline geometries, grouped by direction.
ST_ShiftLongitude
Shifts longitudes in a geometry from the -180..180 range to the 0..360 range (and vice versa).
ST_ShortestLine
Returns the 2D shortest LINESTRING between two geometries; its length equals ST_Distance.
ST_Simplify
Simplifies a geometry using the Douglas-Peucker algorithm with a given tolerance, without preserving topology.
ST_SimplifyPolygonHull
Simplifies a polygon while preserving topology, producing either an inner or outer hull controlled by a vertex ratio.
ST_SimplifyPreserveTopology
Simplifies a geometry with Douglas-Peucker while guaranteeing the result remains a valid geometry.
ST_SimplifyVW
Simplifies a geometry using the Visvalingam-Whyatt algorithm, removing vertices with the smallest effective triangular area.
ST_Snap
Snaps the vertices and segments of a geometry to another geometry's vertices within a tolerance.
ST_SnapToGrid
Snaps all points of a geometry to a regular grid defined by origin and cell size.
ST_Split
Splits a geometry by a cutting geometry and returns the resulting pieces as a GEOMETRYCOLLECTION.
ST_Square
Returns a single square polygon at the given grid coordinate and size; added in PostGIS 3.1.
ST_SquareGrid
Set-returning function that produces a square fishnet grid covering a geometry's bounding box; added in PostGIS 3.1.
ST_SRID
Returns the spatial reference identifier (SRID) of a geometry as defined in the spatial_ref_sys table.
ST_StartPoint
Returns the first Point of a LineString; NULL for non-LineString inputs in most PostGIS versions.
ST_Subdivide
Returns a set of smaller geometries produced by recursively splitting the input until each piece has at most max_vertices.
ST_Summary
Returns a human-readable multi-line text summary of a geometry including type, dimension, vertex count, and bbox.
ST_SwapOrdinates
Swaps two ordinates of a geometry — e.g. X and Y, or Z and M. Available from PostGIS 2.2.
ST_SymDifference
Returns the symmetric difference of two geometries — parts in exactly one of the two but not both.
ST_TileEnvelope
Returns the Web Mercator bounding box polygon for an XYZ tile coordinate; added in PostGIS 3.0.
ST_Touches
Returns true when two geometries share only boundary points and no interior points.
ST_Transform
Reprojects a geometry from its current SRID to the specified target SRID.
ST_TransformPipeline
Transforms a geometry through a user-defined PROJ coordinate operation pipeline. Available from PostGIS 3.4.
ST_Translate
Shifts every vertex of a geometry by the given X, Y, and optionally Z offsets.
ST_TransScale
Translates a geometry by the given offsets, then scales it by the given factors — a convenience for the common trans-then-scale combo.
ST_TriangulatePolygon
Computes a constrained Delaunay triangulation of a polygon, returning triangles that tile the polygon's interior.
ST_UnaryUnion
Unions the components of a single geometry, dissolving overlaps and splitting at self-intersections.
ST_Union
Returns the set-theoretic union of geometries, available as a two-argument function and as an aggregate.
ST_VoronoiLines
Returns the Voronoi diagram edges computed from a set of input points, as a MultiLineString.
ST_VoronoiPolygons
Returns the Voronoi diagram of a set of points as a collection of polygons, one per input point.
ST_Within
Returns true when geometry A lies completely inside geometry B, with at least one shared interior point.
ST_WKBToSQL
SQL/MM alias of ST_GeomFromWKB — constructs a geometry from WKB.
ST_WKTToSQL
SQL/MM alias of ST_GeomFromText — constructs a geometry from a WKT string.
ST_WrapX
Wraps a geometry around a specified X value, moving parts past that value by a given offset.
ST_X
Returns the X coordinate of a Point geometry as a double-precision number.
ST_XMax
Returns the maximum X coordinate of a geometry's bounding box.
ST_XMin
Returns the minimum X coordinate of a geometry's bounding box.
ST_Y
Returns the Y coordinate of a Point geometry as a double-precision number.
ST_YMax
Returns the maximum Y coordinate of a geometry's bounding box.
ST_YMin
Returns the minimum Y coordinate of a geometry's bounding box.
ST_Z
Returns the Z (elevation) coordinate of a Point geometry, or NULL if absent.
ST_ZMax
Returns the maximum Z coordinate of a geometry's 3D bounding box.
ST_Zmflag
Returns a smallint (0, 1, 2, 3) indicating presence of Z and M dimensions — 0=2D, 1=3DM, 2=3DZ, 3=4D.
ST_ZMin
Returns the minimum Z coordinate of a geometry's 3D bounding box.
turf.along
Takes a LineString and returns a Point at a specified distance along the line measured geodetically on the WGS84 ellipsoid.
turf.area
Computes the geodesic area in square meters of one or more GeoJSON polygons using the WGS84 ellipsoid.
turf.bbox
Calculates the bounding box of any GeoJSON Feature, FeatureCollection, or Geometry as a [minX, minY, maxX, maxY] array.
turf.bboxClip
Clips a LineString or Polygon to a bounding box using the Cohen-Sutherland algorithm, trimming coordinates outside the extent.
turf.bboxPolygon
Converts a bounding box array into a rectangular GeoJSON Polygon Feature with five coordinates forming a closed ring.
turf.bearing
Calculates the geodesic initial bearing in degrees between two GeoJSON points, measured clockwise from true north.
turf.bezierSpline
Returns a smoothed LineString by interpolating a bezier spline through the original vertices.
turf.booleanClockwise
Returns true if a ring is wound clockwise, false if counter-clockwise, useful for enforcing GeoJSON winding rules.
turf.booleanConcave
Returns true if a Polygon is concave, false if convex — useful for routing and validation decisions.
turf.booleanContains
Returns true if geometry a fully contains geometry b, with matching interiors and no part of b touching the exterior of a.
turf.booleanCrosses
Returns true if two geometries cross — their intersection is lower-dimensional than both and interior to each.
turf.booleanDisjoint
Returns true if two geometries share no points at all — the exact complement of intersects.
turf.booleanEqual
Returns true if two geometries of the same type have identical coordinates within a configurable precision.
turf.booleanIntersects
Returns true if two geometries share any point at all, covering the full range of OGC intersection cases.
turf.booleanOverlap
Returns true if two same-dimension geometries share area or length without either fully containing the other.
turf.booleanParallel
Returns true if every segment of one LineString is parallel to the corresponding segment of another LineString.
turf.booleanPointInPolygon
Returns true if a Point is inside a Polygon or MultiPolygon, with support for holes and an option to exclude the boundary.
turf.booleanPointOnLine
Returns true if a Point lies on a LineString within a configurable tolerance, with an option to ignore the endpoints.
turf.booleanTouches
Returns true if two geometries share only boundary points and no interior points.
turf.booleanValid
Returns true if a GeoJSON Feature or Geometry conforms to the OGC Simple Feature Specification.
turf.booleanWithin
Returns true if geometry a is fully inside geometry b — the inverse of booleanContains.
turf.buffer
Calculates a buffer for a given GeoJSON Feature, FeatureCollection, or Geometry for a specified distance and units.
turf.center
Returns the absolute center point of a GeoJSON Feature or FeatureCollection based on the midpoint of its bounding box.
turf.centerOfMass
Computes the polygon center of mass using the signed-area method, returning the geometric centroid weighted by area.
turf.centroid
Returns the mean of all vertices in a GeoJSON Feature as a Point, a quick but density-sensitive centroid.
turf.circle
Returns a regular Polygon approximating a circle of the given radius around a centre Point, using the WGS84 sphere.
turf.cleanCoords
Removes redundant coordinates from a GeoJSON Feature, including duplicates and colinear points on lines and polygons.
turf.clone
Returns a deep copy of a GeoJSON Feature, FeatureCollection, or Geometry, faster than JSON.parse(JSON.stringify(...)).
turf.clusterEach
Iterates over each unique cluster in a FeatureCollection, invoking a callback per cluster with the member features and the cluster value.
turf.clusterReduce
Reduces every cluster in a FeatureCollection to a single accumulated value, grouping by a named property.
turf.collect
Aggregates a property from points that fall inside each polygon into an array on the polygon feature.
turf.collectionOf
Throws if a FeatureCollection does not contain Features of the expected geometry type, used for runtime input validation inside Turf helpers.
turf.combine
Combines Point, LineString, or Polygon features into their respective Multi versions in a single FeatureCollection.
turf.concave
Computes a concave hull Polygon around a set of GeoJSON Points using the alpha-shape algorithm with a tunable maxEdge parameter.
turf.containsNumber
Returns true if a (possibly nested) coordinate array contains a number — a fast, low-level coordinate shape check.
turf.convex
Returns the convex hull Polygon of a set of GeoJSON features using the Andrew's monotone chain algorithm.
turf.coordAll
Returns a flat array of every coordinate position found in any GeoJSON Feature, FeatureCollection, or Geometry.
turf.coordEach
Iterates over every coordinate position in any GeoJSON object, invoking a callback with the position and its structural indices.
turf.coordReduce
Reduces every coordinate in a GeoJSON object to a single accumulated value, similar to Array.reduce but traversing all positions.
turf.destination
Returns the destination Point given a start point, distance, and bearing along a great-circle path on the WGS84 ellipsoid.
turf.difference
Returns the polygon difference (A minus B) between two GeoJSON polygons using Martinez-Rueda polygon clipping.
turf.dissolve
Merges adjacent polygons in a FeatureCollection that share edges, optionally filtering by a property key.
turf.distance
Computes the great-circle distance between two GeoJSON points using the haversine formula on the WGS84 sphere.
turf.envelope
Returns the rectangular bounding Polygon of any GeoJSON input, equivalent to bboxPolygon(bbox(input)).
turf.explode
Extracts every coordinate from a GeoJSON input and returns them as a FeatureCollection of Point features.
turf.feature
Wraps a GeoJSON Geometry into a valid GeoJSON Feature with optional properties, bbox, and id.
turf.featureCollection
Wraps an array of GeoJSON Feature objects into a valid FeatureCollection with optional bbox and id.
turf.featureEach
Iterates over each Feature in a GeoJSON object, invoking a callback with the feature and its index.
turf.featureOf
Throws if a Feature's geometry does not match the expected GeoJSON type, used for input validation inside Turf helpers.
turf.featureReduce
Reduces the features of a GeoJSON object to a single value, similar to Array.reduce but accepting any GeoJSON input.
turf.flatten
Splits Multi geometries in a GeoJSON input into individual single-geometry features, returning a FeatureCollection.
turf.flattenEach
Iterates over each flattened single-geometry feature in a GeoJSON object, breaking MultiPoint/MultiLineString/MultiPolygon into parts.
turf.flattenReduce
Reduces every flattened single-part Feature of a GeoJSON object to a single accumulated value.
turf.flip
Swaps the coordinate order of every position in a GeoJSON feature, converting between [lng, lat] and [lat, lng].
turf.geojsonType
Throws if a GeoJSON object's type does not match the expected value, used for input validation inside Turf helpers.
turf.geomEach
Iterates over every Geometry in a GeoJSON object, invoking a callback with the geometry and its structural indices.
turf.geometryCollection
Creates a GeoJSON Feature whose geometry is a GeometryCollection composed of multiple heterogeneous geometries.
turf.geomReduce
Reduces every Geometry of a GeoJSON object to a single accumulated value, with access to the owning Feature's metadata.
turf.getCluster
Returns a FeatureCollection containing only the features whose properties match a filter, typically a single cluster id.
turf.greatCircle
Returns a densified LineString representing the great-circle path between two GeoJSON points, suitable for rendering on maps.
turf.hexGrid
Creates a FeatureCollection of flat-topped hexagons (or triangles) covering a bounding box with a given cell size.
turf.interpolate
Estimates a continuous surface from scattered points using Inverse Distance Weighting and returns a grid of values.
turf.intersect
Returns the polygon intersection of two GeoJSON polygons using the Martinez-Rueda polygon-clipping algorithm.
turf.isobands
Generates filled contour bands (isobands) from a gridded FeatureCollection of Points and an array of break values.
turf.isolines
Produces contour lines (isolines) from a gridded FeatureCollection of Points and an array of break values.
turf.kinks
Finds self-intersections (kinks) in a LineString or Polygon and returns them as a FeatureCollection of Points.
turf.length
Sums the geodesic length of a GeoJSON LineString or MultiLineString using the haversine formula.
turf.lineArc
Returns a LineString arc along a circle of given radius between two bearings around a centre point.
turf.lineChunk
Divides a LineString into equal-length chunks, returning a FeatureCollection of shorter LineString segments.
turf.lineIntersect
Returns the intersection points of two LineStrings, Polygons, or any combination, as a FeatureCollection of Points.
turf.lineOffset
Returns a new LineString offset from the original by a given distance, either left or right of the direction of travel.
turf.lineOverlap
Returns the coincident segments (overlapping portions) between two LineStrings or line-based features within a tolerance.
turf.lineSegment
Decomposes any LineString or Polygon feature into its constituent two-vertex segments as a FeatureCollection.
turf.lineSlice
Returns the sub-LineString between two reference Points that lie on or near a source LineString.
turf.lineSliceAlong
Returns the sub-LineString between two distances measured along the source line in the chosen units.
turf.lineSplit
Splits a LineString at every intersection with another feature, returning a FeatureCollection of LineString parts.
turf.lineString
Creates a GeoJSON LineString Feature from an array of two or more positions with optional properties.
turf.lineToPolygon
Converts a closed LineString or MultiLineString into a Polygon or MultiPolygon, closing the ring if necessary.
turf.mask
Returns a Polygon with a rectangular world outer ring and inner holes formed by the input polygons, useful for inverse fill effects.
turf.midpoint
Returns the geodesic midpoint Point between two input points along the great-circle path on the WGS84 sphere.
turf.multiLineString
Creates a GeoJSON MultiLineString Feature from an array of LineString coordinate arrays with optional properties.
turf.multiPoint
Creates a GeoJSON MultiPoint Feature from an array of positions with optional properties, bbox, and id.
turf.multiPolygon
Creates a GeoJSON MultiPolygon Feature from a nested coordinate array, supporting polygons with holes.
turf.nearestPoint
Returns the closest Point in a FeatureCollection to a target Point, using haversine distance.
turf.nearestPointOnLine
Projects a Point onto the nearest position along a LineString and returns that projected Point with distance and index metadata.
turf.planepoint
Returns the interpolated z-value at a point inside a triangular polygon whose vertices carry a, b, c properties.
turf.point
Creates a GeoJSON Point Feature from a [lng, lat] position with optional properties, bbox, and id.
turf.pointGrid
Creates a FeatureCollection of Points arranged in a regular grid across a bounding box with a given cell spacing.
turf.pointOnFeature
Returns a Point guaranteed to lie on the surface of any GeoJSON Feature, useful for label anchoring on irregular shapes.
turf.pointsWithinPolygon
Filters Points or MultiPoints to those falling within one or more Polygons or MultiPolygons.
turf.pointToLineDistance
Returns the minimum distance from a GeoJSON Point to a LineString in the requested units, optionally using planar or geodesic math.
turf.polygon
Creates a GeoJSON Polygon Feature from an array of linear rings, enforcing closure and minimum ring length.
turf.polygonize
Builds polygons from a network of noded LineStrings, the GeoJSON equivalent of ST_Polygonize in PostGIS.
turf.polygonTangents
Finds the two tangent points on a polygon's exterior ring from a given external point, returned as a FeatureCollection of Points.
turf.polygonToLine
Converts a Polygon or MultiPolygon to its boundary as a LineString or MultiLineString.
turf.propEach
Iterates over the properties object of every Feature in a GeoJSON input, invoking a callback per Feature.
turf.propReduce
Reduces over the properties objects of every Feature in a GeoJSON input to a single accumulated value.
turf.randomLineString
Generates a FeatureCollection of random LineString features within a bounding box for prototyping and tests.
turf.randomPoint
Generates a FeatureCollection of random Point features uniformly distributed across a bounding box.
turf.randomPolygon
Generates a FeatureCollection of random Polygon features within a bounding box for testing and prototyping.
turf.randomPosition
Returns a single random [lng, lat] position within an optional bounding box — the low-level building block for Turf's random helpers.
turf.rewind
Rewinds LineString or Polygon geometries to enforce a specific winding order, following or inverting the right-hand rule.
turf.rhumbBearing
Returns the constant-heading rhumb-line bearing between two GeoJSON points in degrees from true north.
turf.rhumbDestination
Returns the destination Point from an origin travelling a distance and constant bearing along a rhumb line.
turf.rhumbDistance
Computes the rhumb-line (constant heading) distance between two GeoJSON points in the chosen units.
turf.round
Rounds a number to a specified precision, commonly used alongside turf.truncate for coordinate precision management.
turf.sample
Picks a specified number of random features from a FeatureCollection without replacement and returns them as a new FeatureCollection.
turf.sector
Returns a pie-slice Polygon around a centre point bounded by two bearings and a radius, geodetically computed.
turf.segmentEach
Iterates over every two-vertex line segment derived from any LineString or Polygon boundary in a GeoJSON object.
turf.segmentReduce
Reduces every two-vertex line segment of a GeoJSON object to a single accumulated value.
turf.shortestPath
Returns the shortest path LineString between two Points that avoids a set of Polygon obstacles, computed on a grid-based A* search.
turf.simplify
Simplifies GeoJSON geometries using the Ramer-Douglas-Peucker algorithm, reducing vertex count while preserving shape.
turf.square
Expands a bounding box to the smallest square that contains it, returning a new [minX, minY, maxX, maxY] array.
turf.squareGrid
Creates a FeatureCollection of square polygons tiling a bounding box with a given cell size in degrees.
turf.tag
Performs a spatial join that copies a property from the containing Polygon onto each Point within it.
turf.tesselate
Triangulates a GeoJSON Polygon using earcut, returning a FeatureCollection of triangle Polygons suitable for rendering.
turf.tin
Builds a Triangulated Irregular Network (TIN) from a FeatureCollection of points, returning triangular polygons with per-vertex z-values.
turf.transformRotate
Rotates any GeoJSON Feature by a given angle around a pivot Point, using geodesic math on the WGS84 sphere.
turf.transformScale
Scales any GeoJSON Feature by a factor around an origin Point, using geodesic math on the WGS84 sphere.
turf.transformTranslate
Moves a GeoJSON Feature a given distance and direction using rhumb-line translation, optionally with a vertical shift.
turf.triangleGrid
Tiles a bounding box with triangular polygons, producing a FeatureCollection for use in binning, interpolation, and visualisations.
turf.truncate
Truncates coordinate precision in a GeoJSON feature to a given number of decimal places, reducing payload size without changing shape visibly.
turf.union
Returns the union of two or more GeoJSON polygons, merging overlapping or adjacent shapes with polygon-clipping.
turf.unkinkPolygon
Splits a self-intersecting Polygon into multiple valid Polygons, resolving kinks into a clean FeatureCollection.
turf.voronoi
Generates Voronoi polygons for a set of input points, clipped to a bounding box, using d3-voronoi internally.
UpdateGeometrySRID
Updates the SRID metadata of a geometry column and all rows it contains.