ST_GEOGFROMTEXT

Geography Function.

Description

Returns a GEOGRAPHY value that corresponds to the input WKT representation.

For more information, please refer to ST_GEOGFROMTEXT function.

ST_GEOGFROMTEXT function is supported in Snowflake.

Grammar Syntax

ST_GEOGFROMTEXT(wkt_string[, oriented])

Sample Source

The oriented parameter in the ST_GEOGFROMTEXT function is not supported in Snowflake.

BigQuery

SELECT ST_GEOGFROMTEXT('POINT(-122.35 37.55)');
SELECT ST_GEOGFROMTEXT('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))', TRUE);

Snowflake

SELECT ST_GEOGFROMTEXT('POINT(-122.35 37.55)');
SELECT 
--** MSC-WARNING - MSC-BQ0011 - ORIENTED PARAMETER IN THE ST_GEOGFROMTEXT FUNCTION IS NOT SUPPORTED IN SNOWFLAKE. **
ST_GEOGFROMTEXT('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))');

Please keep in mind that the default output format for geography data types is WKT (Well-Known Text) and in Snowflake WKB (Well-Known Binary). You can use the ST_ASWKT function or set the GEOGRAPHY_OUTPUT_FORMAT format if you want to view the data in WKT format.

Using ST_GEOGFROMTEXT function to insert geography data

This function is not allowed in the values clause and is not required in Snowflake.

CREATE OR REPLACE TABLE test.geographyType
(
  COL1 GEOGRAPHY
);

INSERT INTO test.geographyType VALUES
    (ST_GEOGFROMTEXT('POINT(-122.35 37.55)')), 
    (ST_GEOGFROMTEXT('LINESTRING(-124.20 42.00, -120.01 41.99)'));
  • MSC-BQ0010: Geography function is not required in Snowflake.

  • MSC-BQ0011: Oriented parameter in the ST_GEOGFROMTEXT function is not supported in Snowflake.

Last updated