mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
20 lines
378 B
JavaScript
20 lines
378 B
JavaScript
'use strict'
|
|
|
|
const formatCoord = require('./coord')
|
|
|
|
const formatPoi = (p) => {
|
|
// todo: type-checking, better error msgs
|
|
if (!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
|