snowflake.snowpark.functions.st_geogfromgeohash

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

Constructs a GEOGRAPHY object from a geohash string.

Parameters:
  • geohash (ColumnOrName) – The geohash value.

  • precision (ColumnOrName, optional) – The precision level for the geohash conversion.

Returns:

A GEOGRAPHY object representing the polygon area covered by the geohash.

Return type:

Column

Examples::
>>> from snowflake.snowpark.functions import col
>>> df = session.create_dataframe([["9q9j8ue2v71y5zzy0s4q"], ["9q9hpvs0d0uy"]], schema=["geohash"])
>>> df.select(st_geogfromgeohash(col("geohash")).alias("geography")).collect()
[Row(GEOGRAPHY='{\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(GEOGRAPHY='{\n  "coordinates": [\n    [\n      [\n        -1.219975884631276e+02,\n        3.729592826217413e+01\n      ],\n      [\n        -1.219975884631276e+02,\n        3.729592842981219e+01\n      ],\n      [\n        -1.219975881278515e+02,\n        3.729592842981219e+01\n      ],\n      [\n        -1.219975881278515e+02,\n        3.729592826217413e+01\n      ],\n      [\n        -1.219975884631276e+02,\n        3.729592826217413e+01\n      ]\n    ]\n  ],\n  "type": "Polygon"\n}')]
Copy
>>> df2 = session.create_dataframe([["9q9j8ue2v71y5zzy0s4q", 6], ["9q9hpvs0d0uy", 5]], schema=["geohash", "precision"])
>>> df2.select(st_geogfromgeohash(col("geohash"), col("precision")).alias("geography")).collect()
[Row(GEOGRAPHY='{\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}'), Row(GEOGRAPHY='{\n  "coordinates": [\n    [\n      [\n        -1.220361328125000e+02,\n        3.726562500000000e+01\n      ],\n      [\n        -1.220361328125000e+02,\n        3.730957031250000e+01\n      ],\n      [\n        -1.219921875000000e+02,\n        3.730957031250000e+01\n      ],\n      [\n        -1.219921875000000e+02,\n        3.726562500000000e+01\n      ],\n      [\n        -1.220361328125000e+02,\n        3.726562500000000e+01\n      ]\n    ]\n  ],\n  "type": "Polygon"\n}')]
Copy