db-vendo-client/format/poi.js

26 lines
517 B
JavaScript
Raw Normal View History

import {formatLocationIdentifier} from './location-identifier.js';
import {formatCoord} from './coord.js';
2017-11-12 00:53:34 +01:00
const formatPoi = (p) => {
2023-12-07 00:54:29 +01:00
// todo: use Number.isFinite()!
2017-12-12 23:40:12 +01:00
if (p.type !== 'location' || !p.latitude || !p.longitude || !p.id || !p.name) {
throw new TypeError('invalid POI');
2017-12-12 23:15:06 +01:00
}
2017-11-12 00:53:34 +01:00
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),
}),
};
};
2017-11-12 00:53:34 +01:00
2022-05-07 16:17:37 +02:00
export {
formatPoi,
};