ST geospatial functions
Applies to: Databricks Runtime 17.1 and above
This feature is in Public Preview.
ST geospatial functions operate on objects of type GEOGRAPHY
and/or GEOMETRY
, or allow to construct GEOGRAPHY
and GEOMETRY
values from standard or popular geospatial formats, or export GEOGRAPHY
and GEOMETRY
values to standard or popular geospatial formats.
See also:
Import Databricks functions to get ST functions (Databricks Runtime)
No import needed for Databricks SQL and Spark SQL.
To import ST functions for Python or Scala in notebooks, use the following commands:
- Python
- Scala
from pyspark.databricks.sql import functions as dbf
import com.databricks.sql.functions._
List of ST geospatial functions (Databricks SQL)
Import
Function | Description |
---|---|
Returns a | |
Returns a | |
Returns a | |
Returns a | |
Returns a | |
Returns the geohash grid box corresponding to the input geohash value as a 2D polygon geometry. | |
Returns a | |
Returns a | |
Returns a | |
Returns a | |
Returns the center of the geohash grid box corresponding to the input geohash value as a 2D point geometry. | |
Returns a | |
Returns a | |
Returns a | |
Returns a |
Export
Function | Description |
---|---|
Returns the WKB representation of the input | |
Returns the EWKB representation of the input | |
Returns the GeoJSON representation of the input | |
Returns the EWKT representation of the input | |
Returns the WKT representation of the input | |
Returns the WKB representation of the input | |
Returns the WKT representation of the input | |
Returns the geohash of the input geometry at the given precision. |
Measurements
Function | Description |
---|---|
Returns the area of the input | |
Returns the 2D Cartesian distance between the two input | |
Returns the spherical distance (in meters) between two point | |
Returns the geodesic distance (in meters) between two point | |
Returns the length of the input | |
Returns the perimeter of the input |
Constructors
Function | Description |
---|---|
Returns a linestring | |
Constructs a polygon | |
Returns a point |
Accessors
Function | Description |
---|---|
Returns the topological dimension of the 2D projection of the | |
Returns the last point of the input | |
Returns a 2D Cartesian geometry representing the 2D axis-aligned minimum bounding box (envelope) of the input geometry. | |
Returns the envelope of all the geometries in the column, or | |
Returns the exterior ring of the input polygon | |
Returns the 1-based n-th element of the input geometry as a | |
Returns the type of the input | |
Returns true if the input | |
Returns the M coordinate of the input point | |
Returns the coordinate dimension of the input | |
Returns the number of non-empty points in the input | |
Returns the number of geometries in the input | |
Returns the n-th point from the input linestring | |
Returns the first point of the input | |
Returns the X coordinate of the input point | |
Returns the maximum X coordinate of the input | |
Returns the minimum X coordinate of the input | |
Returns the Y coordinate of the input point | |
Returns the maximum Y coordinate of the input | |
Returns the minimum Y coordinate of the input | |
Returns the Z coordinate of the input point | |
Returns the maximum Z coordinate of the input | |
Returns the minimum Z coordinate of the input |
Editors
Function | Description |
---|---|
Adds a new point to the n-th position in the input linestring | |
Swaps X and Y coordinates of the input geometry. | |
Returns the input | |
Removes the n-th point from the input linestring | |
Reverses the input | |
Sets the n-th point of the input linestring |
Geometry Validation
Function | Description |
---|---|
Returns true if the input |
Spatial Reference System Functions
Function | Description |
---|---|
Returns a new | |
Returns the SRID of the input | |
Transforms the X and Y coordinates of the input |
Distance Relationships
Function | Description |
---|---|
Returns true if the 2D Cartesian distance between the two input geometries is smaller than or equal to the input distance. |
Topological Relationships
Function | Description |
---|---|
Returns true if the first | |
Returns true if the first | |
Returns | |
Returns true if the two geometries are geometrically equal, that is if they correspond to the same point set. | |
Returns true if the two geometries intersect. | |
Returns true if the two geometries touch each other. | |
Returns true if the first |
Overlay Functions
Function | Description |
---|---|
Returns the point-set difference of the two input | |
Returns the point-set intersection of the two input geometries as a 2D geometry. | |
Returns the point-set union of the two input geometries as a 2D geometry. | |
Returns the point-wise union of all the geometries in the column, or |
Affine Transformations
Function | Description |
---|---|
Rotates the input | |
Scales the input | |
Translates the input |
Geometry Processing
Function | Description |
---|---|
Returns the buffer of the input | |
Returns the centroid of the input | |
Returns the concave hull of the input | |
Returns the convex hull of the input | |
Simplifies the input |