Created
August 23, 2018 12:03
-
-
Save LouisaKB/100e0b4a37d4ca9b20cba57edfb7e0ab 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
// Creates a function that responds to the selected suggestion. | |
function moveMarker(map, marker) { | |
return function (suggestion) { | |
// The Geocoding API returns coordinates in a [<lng>, <lat>] format. We transform it into Leaflet's LatLng. | |
var latLng = L.latLng(suggestion.data.reverse()); | |
// Change the coordintates for the marker. | |
marker.setLatLng(latLng); | |
// Pan to the map view the new coordinates. | |
map.flyTo(latLng); | |
// Send a Time Map request and draw the isochrone. | |
sendTimeMapRequest(suggestion.data, map) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment