GEOGRAPHY

GEOGRAPHY data type and usages

circle-info

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentationarrow-up-right

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected]envelope.

Thank you for your understanding.

Description

A collection of points, linestrings, and polygons, which is represented as a point set, or a subset of the surface of the Earth. For more information please refer to BigQuery GEOGRAPHY data typearrow-up-right.

circle-check

Sample Source Patterns

GEOGRAPHY output format

The default output format for geography data types in BigQuery is WKT (Well-Known Text) and in Snowflake WKB (Well-Known Binary). For this reason, when geography columns are selected, the ST_ASWKTarrow-up-right function is automatically added. In addition, when all the columns of a table are selected and it contains a Geography column, the GEOGRAPHY_OUTPUT_FORMATarrow-up-right is set to WKT. This is in order to keep the default BigQuery format.

Input Code:

IN -> BigQuery_01.sql
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)'));

SELECT COL1 FROM test.geographyType;
SELECT * FROM test.geographyType;	

Output Code:

In case it is not added automatically and you want to see the data in WKT format, you can use the ST_ASWKTarrow-up-right function or set the GEOGRAPHY_OUTPUT_FORMATarrow-up-right format.

Insert GEOGRAPHY data

To insert data in geography type columns, no function is needed, because Snowflake automatically detects that the data follows the WGS 84 standardarrow-up-right.

Observations

  • 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_ASWKTarrow-up-right function or set the GEOGRAPHY_OUTPUT_FORMATarrow-up-right format if you want to view the data in WKT format.

  • Geography functions used to insert data into a values clause are not needed in Snowflake. Please refer to Geography Functionsarrow-up-right documentation to learn more about this.

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

Last updated