Udvider l0okys svar, GeoJSON-specifikationen til geometriske objekter.
Points:
var point = { type: 'Point', coordinates: [39.807222,-76.984722]};
User.create({username: 'username', geometry: point }).then(function(newUser) {
...
});
Linjestrenge:
var line = { type: 'LineString', 'coordinates': [ [100.0, 0.0], [101.0, 1.0] ] };
User.create({username: 'username', geometry: line }).then(function(newUser) {
...
});
Polygoner:
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) {
...
});
Indstilling af et tilpasset 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) {
...
});