Created
May 12, 2023 21:58
-
-
Save rayrayzayzay/e468d3b863ab63de0f08f9608797d3cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFullRouteGeometry(coords, viewport) { | |
const roundedZoom = Math.round(viewport.zoom) | |
const fromCache = cache.get(roundedZoom).get(coords) | |
if (fromCache) return clipToViewport(fromCache, viewport); | |
const simplified = simplify(coords, 1 / roundedZoom) | |
cache.get(roundedZoom).set(coords, simplified); | |
return clipToViewport(simplified, viewport); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment