ramnathv / rMaps

Interactive Maps from R
http://rmaps.github.io
388 stars 194 forks source link

Routes not showing #111

Closed shahan92 closed 8 years ago

shahan92 commented 8 years ago

my code is

render map

output$map <- renderLeaflet({ map <- leaflet() %>% #addProviderTiles("CartoDB.DarkMatter") %>% addTiles( urlTemplate = "//{s}.tiles.mapbox.com/v3/jcheng.map-5ebohr46/{z}/{x}/{y}.png", attribution = 'Maps by Mapbox' ) %>% setView(lng = -93.85, lat = 37.45, zoom = 4) map })

routes

output$routeMap <- renderUI({ map mywaypoints = d tags$body(tags$script(HTML(sprintf( "var mywaypoints = %s var index; var arrays = []; for (index = 0; index < mywaypoints.length; ++index) { while(mywaypoints[index].length){ arrays.push(mywaypoints[index].splice(0, 2)); } } for(var i = 0; i < arrays.length; i++) {
L.Routing.control({ waypoints: [ L.latLng(arrays[i]), L.latLng(arrays[i+1]) ] }).addTo(map) }", RJSONIO::toJSON(mywaypoints) )))) }) Please help thanks