db-vendo-client/format/poi.js

25 lines
476 B
JavaScript
Raw Normal View History

2022-05-07 16:17:37 +02:00
import {formatLocationIdentifier} from './location-identifier.js'
import {formatCoord} from './coord.js'
2017-11-12 00:53:34 +01:00
const formatPoi = (p) => {
2017-12-12 23:40:12 +01:00
if (p.type !== 'location' || !p.latitude || !p.longitude || !p.id || !p.name) {
2019-02-13 17:55:57 +01:00
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,
}