任何人都知道如何在Sails js模型中存储GEOJSON?我想在Sails js模型中存储特征和点。
var geojsonFeature = {
"type": "Feature",
"properties": {
"name": "Coors Field",
"amenity": "Baseball Stadium",
"popupContent": "This is where the Rockies play!"
},
"geometry": {
"type": "Point",
"coordinates": [-104.99404, 39.75621]
}
};
在Sails' Attributes documentation中,您可以找到Sail的水线支持的5种类型(Sail中的基础ORM)
在您的情况下,您嵌入了多个对象。类似以下内容可能会起作用:
attributes: {
type: {
type: 'string',
enum: ['Feature','This','That','Other'], // not required...
},
properties: {
type: 'json'
},
geometry: {
type: 'json'
}
}