mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59:35 +02:00
25 lines
517 B
JavaScript
25 lines
517 B
JavaScript
import {formatLocationIdentifier} from './location-identifier.js';
|
|
import {formatCoord} from './coord.js';
|
|
|
|
const formatPoi = (p) => {
|
|
// todo: use Number.isFinite()!
|
|
if (p.type !== 'location' || !p.latitude || !p.longitude || !p.id || !p.name) {
|
|
throw new TypeError('invalid POI');
|
|
}
|
|
|
|
return {
|
|
type: 'P', // POI
|
|
name: p.name,
|
|
lid: formatLocationIdentifier({
|
|
A: '4', // POI?
|
|
O: p.name,
|
|
L: p.id,
|
|
X: formatCoord(p.longitude),
|
|
Y: formatCoord(p.latitude),
|
|
}),
|
|
};
|
|
};
|
|
|
|
export {
|
|
formatPoi,
|
|
};
|