Created
January 7, 2016 16:11
-
-
Save efwe/28c03b9c10c15cfda165 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
pointClicked: (point, options, event) -> | |
if @marker | |
@map.removeLayer(@marker) | |
@marker = L.marker(point).addTo(@map) | |
clickBack = (event) -> | |
L.DomEvent.stopPropagation(event) | |
@marker.on('click', clickBack) | |
callback = (response) => | |
if @geoJsonLayer | |
@map.removeLayer(@geoJsonLayer) | |
@geoJsonLayer = L.geoJson(response,{ | |
onEachFeature: (feature, layer) => | |
@marker.bindPopup('<a href="geo/routes/'+feature.properties.route_id.$oid+'">'+feature.properties.route_title+'</a><br>'+feature.properties.route_start) | |
}) | |
@map.addLayer(@geoJsonLayer) | |
$.get '/map/routes/to/' + point[0] + '/' + point[1], callback, 'json' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment