Querying spatial data in Amazon Redshift
Spatial data describes the position and shape of a geometry in a defined space (a
spatial
reference system). Amazon Redshift supports spatial data with the GEOMETRY
data type, which
contains spatial data and optionally its spatial reference system identifier (SRID).
Spatial data contains geometric data that can be used to represent geographic features. Examples of this type of data include weather reports, map directions, tweets with geographic positions, store locations, and airline routes. Spatial data plays an important role in business analytics, reporting, and forecasting.
You can query spatial data with Amazon Redshift SQL functions. Spatial data contains geometric values for an object.
Using spatial data, you can run queries to do the following:

Find the distance between two points.

Check whether one area (polygon) contains another.

Check whether one linestring intersects another linestring or polygon.
You can use the GEOMETRY
data type to hold the values of spatial data. A
GEOMETRY
value in Amazon Redshift can define twodimensional (2D) geometry primitives.
Currently, Amazon Redshift doesn't support 3D or 4D geometry primitives. For more
information about
geometry primitives, see Wellknown
text representation of geometry
The GEOMETRY
data type has the following subtypes:

POINT

LINESTRING

POLYGON

MULTIPOINT

MULTILINESTRING

MULTIPOLYGON

GEOMETRYCOLLECTION
There are Amazon Redshift SQL functions that support the following representations of geometric data:

GeoJSON

Wellknown text (WKT)

Extended wellknown text (EWKT)

Wellknown binary (WKB) representation

Extended wellknown binary (EWKB)
For details about SQL functions to query spatial data, see Spatial functions.