strava-geojson
Version:
pull strava runs and convert them to geojson
20 lines (18 loc) • 498 B
JavaScript
module.exports = convert;
function convert(stream) {
if (!stream || !stream.filter) return;
return stream.filter(function(e) {
return e.type === 'latlng';
}).map(function(e) {
return {
type: 'Feature',
geometry: {
type: 'LineString',
coordinates: e.data.map(function(coord) {
return coord.slice().reverse();
})
},
properties: {}
};
})[0];
}