Skip to content

Instantly share code, notes, and snippets.

@efwe
Last active January 14, 2016 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save efwe/c78ad24bad8368412b4f to your computer and use it in GitHub Desktop.
Save efwe/c78ad24bad8368412b4f to your computer and use it in GitHub Desktop.
firstRouteToPoint: (hashPoint) ->
callback = (response) =>
L.geoJson(response).addTo(@map)
$.get '/map/first/route/to/' + hashPoint[0] + '/' + hashPoint[1], callback, 'json'
addRoutesToPoint: (hashPoint) ->
callback = (response) =>
L.geoJson(response, {
style: (feature) =>
return {color: @random_color()}
}).addTo(@map)
$.get '/map/routes/to/' + hashPoint[0] + '/' + hashPoint[1], callback, 'json'
random_color: () ->
letters = '0123456789ABCDEF'.split('')
color = '#'
color += letters[Math.round(Math.random() * 15)] for [0..5]
color
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment