snowflake.snowpark.functions.st_geomfromgeohash

snowflake.snowpark.functions.st_geomfromgeohash(geohash: Union[snowflake.snowpark.column.Column, str], precision: Union[snowflake.snowpark.column.Column, str] = None) Column[source]

Constructs a GEOMETRY object from a geohash string.

Parameters:
  • geohash (ColumnOrName) – A column or string containing the geohash value

  • precision (ColumnOrName, optional) – A column or value specifying the precision level for the geohash conversion

Returns:

A GEOMETRY object representing the polygon area covered by the geohash

Return type:

Column

Examples::
>>> from snowflake.snowpark.functions import col, lit
>>> df = session.create_dataframe([["9q9j8ue2v71y5zzy0s4q"], ["9q9j8u"]], schema=["geohash"])
>>> df.select(st_geomfromgeohash(col("geohash")).alias("geometry")).collect()
[Row(GEOMETRY='{\n  "coordinates": [\n    [\n      [\n        -1.223061000000001e+02,\n        3.755416199999996e+01\n      ],\n      [\n        -1.223061000000001e+02,\n        3.755416200000012e+01\n      ],\n      [\n        -1.223060999999998e+02,\n        3.755416200000012e+01\n      ],\n      [\n        -1.223060999999998e+02,\n        3.755416199999996e+01\n      ],\n      [\n        -1.223061000000001e+02,\n        3.755416199999996e+01\n      ]\n    ]\n  ],\n  "type": "Polygon"\n}'), Row(GEOMETRY='{\n  "coordinates": [\n    [\n      [\n        -1.223107910156250e+02,\n        3.755126953125000e+01\n      ],\n      [\n        -1.223107910156250e+02,\n        3.755676269531250e+01\n      ],\n      [\n        -1.222998046875000e+02,\n        3.755676269531250e+01\n      ],\n      [\n        -1.222998046875000e+02,\n        3.755126953125000e+01\n      ],\n      [\n        -1.223107910156250e+02,\n        3.755126953125000e+01\n      ]\n    ]\n  ],\n  "type": "Polygon"\n}')]
Copy
>>> df2 = session.create_dataframe([["9q9j8ue2v71y5zzy0s4q"]], schema=["geohash"])
>>> df2.select(st_geomfromgeohash(col("geohash"), lit(6)).alias("geometry")).collect()
[Row(GEOMETRY='{\n  "coordinates": [\n    [\n      [\n        -1.223107910156250e+02,\n        3.755126953125000e+01\n      ],\n      [\n        -1.223107910156250e+02,\n        3.755676269531250e+01\n      ],\n      [\n        -1.222998046875000e+02,\n        3.755676269531250e+01\n      ],\n      [\n        -1.222998046875000e+02,\n        3.755126953125000e+01\n      ],\n      [\n        -1.223107910156250e+02,\n        3.755126953125000e+01\n      ]\n    ]\n  ],\n  "type": "Polygon"\n}')]
Copy