mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 23:29:35 +02:00
24 lines
494 B
JavaScript
24 lines
494 B
JavaScript
'use strict'
|
|
|
|
const formatLocationIdentifier = require('./location-identifier')
|
|
const formatCoord = require('./coord')
|
|
|
|
const formatPoi = (p) => {
|
|
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)
|
|
})
|
|
}
|
|
}
|
|
|
|
module.exports = formatPoi
|