Created
February 21, 2023 08:13
-
-
Save TravelTime-Frontend/b81cd57cf24f8805ac4238c7d5fd564f 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 drawTimeMap(map, response) { | |
// Reference for the response: http://docs.traveltimeplatform.com/reference/time-map/#response-body-json-attributes | |
var shapesCoords = response.results[0].shapes.map(function (polygon) { | |
var shell = ringCoordsHashToArray(polygon.shell); | |
var holes = polygon.holes.map(ringCoordsHashToArray); | |
return [shell].concat(holes); | |
}); | |
var polygon = L.polygon(shapesCoords, { color: 'red' }); | |
polygon.addTo(map); | |
map.fitBounds(polygon.getBounds()); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment