mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
@mapbox/polyline -> google-polyline
This commit is contained in:
parent
f771e9fb5d
commit
db9287f7fd
2 changed files with 6 additions and 6 deletions
|
@ -34,10 +34,10 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@derhuerst/br2nl": "^1.0.0",
|
"@derhuerst/br2nl": "^1.0.0",
|
||||||
"@mapbox/polyline": "^1.0.0",
|
|
||||||
"capture-stack-trace": "^1.0.0",
|
"capture-stack-trace": "^1.0.0",
|
||||||
"create-hash": "^1.2.0",
|
"create-hash": "^1.2.0",
|
||||||
"fetch-ponyfill": "^6.0.0",
|
"fetch-ponyfill": "^6.0.0",
|
||||||
|
"google-polyline": "^1.0.3",
|
||||||
"gps-distance": "0.0.4",
|
"gps-distance": "0.0.4",
|
||||||
"lodash": "^4.17.5",
|
"lodash": "^4.17.5",
|
||||||
"luxon": "^1.3.0",
|
"luxon": "^1.3.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const {toGeoJSON} = require('@mapbox/polyline')
|
const {decode} = require('google-polyline')
|
||||||
const distance = require('gps-distance')
|
const distance = require('gps-distance')
|
||||||
|
|
||||||
// todo: what is p.delta?
|
// todo: what is p.delta?
|
||||||
|
@ -8,15 +8,15 @@ const distance = require('gps-distance')
|
||||||
// todo: what is p.crdEncS?
|
// todo: what is p.crdEncS?
|
||||||
// todo: what is p.crdEncF?
|
// todo: what is p.crdEncF?
|
||||||
const parsePolyline = (ctx, p) => { // p = raw polyline
|
const parsePolyline = (ctx, p) => { // p = raw polyline
|
||||||
const shape = toGeoJSON(p.crdEncYX)
|
const points = decode(p.crdEncYX)
|
||||||
if (shape.coordinates.length === 0) return null
|
if (points.length === 0) return null
|
||||||
|
|
||||||
const res = shape.coordinates.map(crd => ({
|
const res = points.map(([lat, lon]) => ({
|
||||||
type: 'Feature',
|
type: 'Feature',
|
||||||
properties: {},
|
properties: {},
|
||||||
geometry: {
|
geometry: {
|
||||||
type: 'Point',
|
type: 'Point',
|
||||||
coordinates: crd
|
coordinates: [lon, lat]
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue