mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
21 lines
367 B
JavaScript
21 lines
367 B
JavaScript
'use strict'
|
|
|
|
const formatCoord = require('./coord')
|
|
|
|
const formatPoi = (p) => {
|
|
if (!p.type !== 'location' || !p.latitude || !p.longitude || !p.id || !p.name) {
|
|
throw new Error('invalid POI')
|
|
}
|
|
|
|
return {
|
|
type: 'P',
|
|
name: p.name,
|
|
lid: 'L=' + p.id,
|
|
crd: {
|
|
x: formatCoord(p.longitude),
|
|
y: formatCoord(p.latitude)
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = formatPoi
|