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 ST_GeomFromGeoJSON
. In MySQL it is parsed using the function GeomFromText
.
Therefore, one can just follow the GeoJSON spec for handling geometry objects. See the following examples:
DataTypes.GEOMETRY
DataTypes.GEOMETRY('POINT')
DataTypes.GEOMETRY('POINT', 4326)
const point = { type: 'Point', coordinates: [39.807222,-76.984722]};
User.create({username: 'username', geometry: point });
const line = { type: 'LineString', 'coordinates': [ [100.0, 0.0], [101.0, 1.0] ] };
User.create({username: 'username', geometry: line });
Public Constructor | ||
---|---|---|
public | constructor(type: string, srid: string) |
Copyright © 2014–present Sequelize contributors
Licensed under the MIT License.
https://sequelize.org/master/class/lib/data-types.js~GEOMETRY.html