Skip to content

Instantly share code, notes, and snippets.

@corynissen
Last active August 29, 2015 14:02
Show Gist options
  • Save corynissen/e6b750c905a77c9046ab to your computer and use it in GitHub Desktop.
Save corynissen/e6b750c905a77c9046ab to your computer and use it in GitHub Desktop.
leaflet map using rCharts
library(rCharts)
bus.map <- Leaflet$new()
bus.map$setView(c(40.4739, -88.9719), zoom = 13)
bus.map$tileLayer(provider = 'Stamen.TonerLite')
# Add Data as GeoJSON Layer and Specify Popup and FillColor
bus.map$geoJson(toGeoJSON(tmp.data, lat = 'lat', lon = 'lon'),
onEachFeature = '#! function(feature, layer){
layer.bindPopup(feature.properties.popup)
} !#',
pointToLayer = "#! function(feature, latlng){
return L.circleMarker(latlng, {
radius: 5,
fillColor: feature.properties.color || 'red',
color: '#000',
weight: 1,
fillOpacity: 0.8
})
} !#"
)
bus.map$set(width = 1600, height = 800)
bus.map$enablePopover(TRUE)
#bus.map$publish('Bloomington IL Bus Stops', host = 'gist')
bus.map$save("index.html", cdn=T)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment