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.

Grammar Syntax

ST_GEOGFROMTEXT(wkt_string[, oriented])

Sample Source

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

Input Code:

IN -> BigQuery_01.sql
SELECT ST_GEOGFROMTEXT('POINT(-122.35 37.55)');
SELECT ST_GEOGFROMTEXT('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))', TRUE);

Output Code:

OUT -> BigQuery_01.sql
SELECT ST_GEOGFROMTEXT('POINT(-122.35 37.55)');
SELECT
!!!RESOLVE EWI!!! /*** SSC-EWI-BQ0006 - 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.

Input Code:

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)'));

Output Code:

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

INSERT INTO test.geographyType
VALUES
    (
     --** SSC-FDM-BQ0010 - THE FUNCTION 'ST_GEOGFROMTEXT' IS NOT REQUIRED IN SNOWFLAKE. **
     'POINT(-122.35 37.55)'),
    (
     --** SSC-FDM-BQ0010 - THE FUNCTION 'ST_GEOGFROMTEXT' IS NOT REQUIRED IN SNOWFLAKE. **
     'LINESTRING(-124.20 42.00, -120.01 41.99)');
  1. SSC-EWI-BQ0006: Oriented parameter in the ST_GEOGFROMTEXT function is not supported in Snowflake.

  2. SSC-FDM-BQ0010: Geography function is not required in Snowflake.

Last updated