2024-12-07 16:16:31 +00:00
|
|
|
const parsePolyline = (ctx, p) => { // p = raw polylineGroup
|
|
|
|
if (p.polylineDescriptions.length < 2) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
const points = p.polylineDescriptions[1].coordinates;
|
2024-02-06 22:58:49 +01:00
|
|
|
if (points.length === 0) {
|
|
|
|
return null;
|
|
|
|
}
|
2018-05-16 21:07:05 +02:00
|
|
|
|
2024-12-07 16:16:31 +00:00
|
|
|
const res = points.map(ll => ({
|
2019-10-20 00:19:11 +02:00
|
|
|
type: 'Feature',
|
|
|
|
properties: {},
|
|
|
|
geometry: {
|
|
|
|
type: 'Point',
|
2024-12-07 16:16:31 +00:00
|
|
|
coordinates: [ll.lng, ll.lat],
|
2024-02-06 22:58:49 +01:00
|
|
|
},
|
|
|
|
}));
|
2018-05-16 21:07:05 +02:00
|
|
|
|
2024-12-07 16:16:31 +00:00
|
|
|
// TODO initial and final descriptions?, match station info?
|
2019-10-20 00:19:11 +02:00
|
|
|
|
|
|
|
return {
|
|
|
|
type: 'FeatureCollection',
|
2024-02-06 22:58:49 +01:00
|
|
|
features: res,
|
|
|
|
};
|
|
|
|
};
|
2018-05-16 21:07:05 +02:00
|
|
|
|
2022-05-07 16:17:37 +02:00
|
|
|
export {
|
|
|
|
parsePolyline,
|
2024-02-06 22:58:49 +01:00
|
|
|
};
|