snowflake.snowpark.functions.to_geography¶

snowflake.snowpark.functions.to_geography(e: Union[Column, str]) → Column[source]¶

Parses an input and returns a value of type GEOGRAPHY. Supported inputs are strings in

  • WKT (well-known text).

  • WKB (well-known binary) in hexadecimal format (without a leading 0x).

  • EWKT (extended well-known text).

  • EWKB (extended well-known binary) in hexadecimal format (without a leading 0x).

  • GeoJSON.

format.

Example::
>>> df = session.create_dataframe(['POINT(-122.35 37.55)', 'POINT(20.92 43.33)'], schema=['a'])
>>> df.select(to_geography(col("a"))).collect()
[Row(TO_GEOGRAPHY("A")='{\n  "coordinates": [\n    -122.35,\n    37.55\n  ],\n  "type": "Point"\n}'), Row(TO_GEOGRAPHY("A")='{\n  "coordinates": [\n    20.92,\n    43.33\n  ],\n  "type": "Point"\n}')]
Copy

Besides strings, binary representation in WKB and EWKB format can be parsed, or objects adhering to GeoJSON format. For all supported formats confer https://docs.snowflake.com/en/sql-reference/data-types-geospatial#supported-geospatial-object-types.