mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-29 11:21:40 +02:00
32 lines
870 B
JavaScript
32 lines
870 B
JavaScript
iD.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.lon, entity.lat]
|
|
}
|
|
};
|
|
},
|
|
way: function(entity) {
|
|
return {
|
|
type: 'Feature',
|
|
properties: entity.tags,
|
|
geometry: {
|
|
'type': 'LineString',
|
|
'coordinates': _.map(entity.children, function(node) {
|
|
return [node.lon, node.lat];
|
|
})
|
|
}
|
|
};
|
|
}
|
|
}
|
|
};
|