Skip to main content

st_geomfromgeohash function

Applies to: check marked yes Databricks Runtime 17.1 and above

Preview

This feature is in Public Preview.

Returns the geohash grid box corresponding to the input geohash value as a 2D polygon geometry.

Syntax

st_geomfromgeohash ( geohash )

Arguments

  • geohash: A STRING value representing a geohash value.

Returns

A value of type GEOMETRY, representing the geohash grid box as a polygon.

The SRID value of the returned polygon is 0. The returned polygon is clockwise oriented.

See Wikipedia for more details on geohashes.

The function returns NULL if the input is NULL.

Examples

SQL
-- Returns the geohash grid box as a polygon.
> SELECT st_astext(st_geomfromgeohash('9q8yyh'));
POLYGON((-122.431640625 37.77099609375,-122.431640625 37.7764892578125,-122.420654296875 37.7764892578125,-122.420654296875 37.77099609375,-122.431640625 37.77099609375))