mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 17:23:02 +00:00
32 lines
845 B
JavaScript
32 lines
845 B
JavaScript
iD.format.GeoJSON = {
|
|
mapping: function(entity) {
|
|
if (this.mappings[entity.type]) {
|
|
return this.mappings[entity.type](entity);
|
|
}
|
|
},
|
|
mappings: {
|
|
node: function(entity) {
|
|
return {
|
|
type: 'Feature',
|
|
properties: entity.tags,
|
|
geometry: {
|
|
type: 'Point',
|
|
coordinates: entity.loc
|
|
}
|
|
};
|
|
},
|
|
way: function(entity) {
|
|
return {
|
|
type: 'Feature',
|
|
properties: entity.tags,
|
|
geometry: {
|
|
'type': 'LineString',
|
|
'coordinates': entity.nodes.map(function(node) {
|
|
return node.loc;
|
|
})
|
|
}
|
|
};
|
|
}
|
|
}
|
|
};
|