A column storing Geometry information. It is only available in PostgreSQL (with PostGIS), MariaDB or MySQL.

GeoJSON is accepted as input and returned as output.

In PostGIS, the GeoJSON is parsed using the PostGIS function STGeomFromGeoJSON. In MySQL it is parsed using the function STGeomFromText.

Therefore, one can just follow the GeoJSON spec for handling geometry objects. See the following examples:

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

Example: Defining a Geometry type attribute

DataTypes.GEOMETRY('POINT', 4326)

Example: Create a new point

const point = { type: 'Point', coordinates: [-76.984722, 39.807222]}; // GeoJson format: [lng, lat]

User.create({username: 'username', geometry: point });

Example: Create a new linestring

const line = { type: 'LineString', 'coordinates': [ [100.0, 0.0], [101.0, 1.0] ] };

User.create({username: 'username', geometry: line });

Example: Create a new polygon

const polygon = { type: 'Polygon', coordinates: [
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
[100.0, 1.0], [100.0, 0.0] ]

User.create({username: 'username', geometry: polygon });

Example: Create a new point with a custom SRID

const point = {
type: 'Point',
coordinates: [-76.984722, 39.807222], // GeoJson format: [lng, lat]
crs: { type: 'name', properties: { name: 'EPSG:4326'} }

User.create({username: 'username', geometry: point })

Hierarchy (view full)



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

Where this DataType is being used.


  • 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.


    • value: unknown

      The value to parse.

    Returns unknown