Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 3e5b8772
authored
Jan 26, 2016
by
djstroky
Committed by
Jan Aagaard Meier
Feb 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documentation of Geometry usage/
1 parent
54797225
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
1 deletions
lib/data-types.js
lib/data-types.js
View file @
3e5b877
...
...
@@ -816,7 +816,53 @@ var helpers = {
};
/**
* A geometry datatype represents two dimensional spacial objects.
* A column storing Geometry information.
*
* Only available in PostgreSQL (with PostGIS) or MySQL.
* In MySQL, allowable Geometry types are 'POINT', 'LINESTRING', 'POLYGON'.
*
* When using, 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](http://geojson.org/geojson-spec.html) for handling geometry objects. See the following examples:
*
* ```js
* // Create a new point:
* var point = { type: 'Point', coordinates: [39.807222,-76.984722]};
*
* User.create({username: 'username', geometry: point }).then(function(newUser) {
* ...
* });
*
* // Create a new linestring:
* var line = { type: 'LineString', 'coordinates': [ [100.0, 0.0], [101.0, 1.0] ] };
*
* User.create({username: 'username', geometry: line }).then(function(newUser) {
* ...
* });
*
* // Create a new polygon:
* var 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 }).then(function(newUser) {
* ...
* });
* // Create a new point with a custom SRID:
* var point = {
* type: 'Point',
* coordinates: [39.807222,-76.984722],
* crs: { type: 'name', properties: { name: 'EPSG:4326'} }
* };
*
* User.create({username: 'username', geometry: point }).then(function(newUser) {
* ...
* });
* ```
*
* @property GEOMETRY
*/
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment