Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function createDestinationTravelTimeDistribution(
destination,
travelTimeSurface
) {
if (destination == null || travelTimeSurface == null) return null
let {x, y} = lonlat.toPixel(destination, travelTimeSurface.zoom)
// floor them to get top left of cell the point is a part of (TODO correct?)
x = Math.floor(x - travelTimeSurface.west)
y = Math.floor(y - travelTimeSurface.north)
return {
low: travelTimeSurface.get(x, y, 0),
iqrLow: travelTimeSurface.get(x, y, 1),
med: travelTimeSurface.get(x, y, 2),
iqrHigh: travelTimeSurface.get(x, y, 3),
high: travelTimeSurface.get(x, y, 4)
}
}
export default function coordinateToPoint (coordinate, zoom, west, north) {
const pixel = lonlat.toPixel(coordinate, zoom)
return {
x: (pixel.x - west) | 0,
y: (pixel.y - north) | 0
}
}
export default function reproject(ll) {
const p = lonlat.toPixel(ll, Z)
return lonlat.fromPixel(
{
x: Math.round(p.x),
y: Math.round(p.y)
},
Z
)
}