A geography datatype represents two dimensional spacial objects in an elliptic coord system.

The difference from geometry and geography type:

PostGIS 1.5 introduced a new spatial type called geography, which uses geodetic measurement instead of Cartesian measurement. Coordinate points in the geography type are always represented in WGS 84 lon lat degrees (SRID 4326), but measurement functions and relationships STDistance, STDWithin, STLength, and STArea always return answers in meters or assume inputs in meters.

What is best to use? It depends:

When choosing between the geometry and geography type for data storage, you should consider what you’ll be using it for. If all you do are simple measurements and relationship checks on your data, and your data covers a fairly large area, then most likely you’ll be better off storing your data using the new geography type. Although the new geography data type can cover the globe, the geometry type is far from obsolete. The geometry type has a much richer set of functions than geography, relationship checks are generally faster, and it has wider support currently across desktop and web-mapping tools

Fallback policy: If this type is not supported, an error will be raised.

Example: Defining a Geography type attribute

DataTypes.GEOGRAPHY
DataTypes.GEOGRAPHY('POINT')
DataTypes.GEOGRAPHY('POINT', 4326)

Hierarchy (view full)

Constructors

Properties

#dialect: undefined | AbstractDialect<object, object>
usageContext: undefined | DataTypeUseContext

Where this DataType is being used.

Methods

  • Called when a value is retrieved from the Database, and its DataType is specified. Used to normalize values from the database.

    Note: It is also possible to do an initial parsing of a Database value using AbstractDialect#registerDataTypeParser. That normalization uses the type ID from the database instead of a Sequelize Data Type to determine which parser to use, and is called before this method.

    Parameters

    • value: unknown

      The value to parse.

    Returns unknown