st_estimatesrid function
Applies to: Databricks Runtime 18.1 and above
Preview
This feature is in Public Preview.
Returns the best projected spatial reference identifier (SRID) for the center of the bounding box of the input GEOMETRY value. The returned SRID value represents either a Universal Transverse Mercator (UTM) projected coordinate system or a Universal Polar Stereographic (UPS) projected coordinate system.
Syntax
st_estimatesrid ( geoExpr )
Arguments
geoExpr: AGEOMETRYvalue with coordinates in degrees in the range [-180, 180] for longitudes and [-90, 90] for latitudes.
Returns
A value of type INTEGER, representing the best Universal Transverse Mercator (UTM) or Universal Polar Stereographic (UPS) SRID for the center of the bounding box of the input GEOMETRY value.
Notes
The function returns NULL if the input geometry is empty or if the input is NULL.
Examples
SQL
-- Returns UTM zone 10N SRID for a point in San Francisco.
> SELECT st_estimatesrid(st_geomfromtext('POINT(-122.419 37.775)'));
32610
-- Returns UTM zone 31N SRID for a polygon near the prime meridian.
> SELECT st_estimatesrid(st_geomfromtext('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'));
32631
-- Returns UPS North SRID for a linestring near the North Pole.
> SELECT st_estimatesrid(st_geomfromtext('LINESTRING(-180 89, 180 89)'));
32661
-- Returns NULL for an empty point.
> SELECT st_estimatesrid(st_geomfromtext('POINT EMPTY'));
NULL