GEOGRAPHY

Data Type and usages

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.

BigQuery


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;	

Snowflake

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.

Sample Source

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 Functions documentation to learn more about this.

Last updated

Was this helpful?