Created
January 21, 2017 15:21
-
-
Save tim-salabim/ba787b378720c3928dcf150345c35eb5 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
# devtools::install_github("rstudio/leaflet", force = TRUE) | |
library(leaflet) | |
library(sf) | |
### polygons -------------------------------------------------------------- | |
poldata <- st_as_sf(mapview::gadmCHE) | |
class(poldata) | |
class(st_geometry(poldata)) | |
class(st_geometry(poldata)[[1]]) | |
leaflet() %>% addTiles() %>% addPolygons(data = poldata) | |
leaflet() %>% addTiles() %>% addPolygons(data = st_geometry(poldata)) | |
leaflet() %>% addTiles() %>% addPolygons(data = st_geometry(poldata)[[1]]) # error | |
### lines ----------------------------------------------------------------- | |
lindata <- st_as_sf(mapview::atlStorms2005) | |
class(lindata) | |
class(st_geometry(lindata)) | |
class(st_geometry(lindata)[[1]]) | |
leaflet() %>% addTiles() %>% addPolylines(data = lindata) # error | |
leaflet() %>% addTiles() %>% addPolylines(data = st_geometry(lindata)) # error | |
leaflet() %>% addTiles() %>% addPolylines(data = st_geometry(lindata)[[1]]) # error | |
### points ---------------------------------------------------------------- | |
ptsdata <- st_as_sf(mapview::breweries91) | |
class(ptsdata) | |
class(st_geometry(ptsdata)) | |
class(st_geometry(ptsdata)[[1]]) | |
leaflet() %>% addTiles() %>% addCircleMarkers(data = ptsdata) | |
leaflet() %>% addTiles() %>% addCircleMarkers(data = st_geometry(ptsdata)) | |
leaflet() %>% addTiles() %>% addCircleMarkers(data = st_geometry(ptsdata)[[1]]) # error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
my sessionInfo for this gist is: