Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

L.multipolyline doesn't exist #515

Merged
merged 2 commits into from
Apr 6, 2018
Merged

Conversation

schloerke
Copy link
Contributor

@schloerke schloerke commented Apr 4, 2018

Fixes: #512

R addPolylines() was broken when trying to use L.multiPolyline. Docs in: http://leafletjs.com/reference-1.3.0.html#polyline state L.polyline accepts an array of polyline objects, like what L.multiPolyline should accept. Changed the erroring function to L.polyline.

library(leaflet)
library(tigris)
#> To enable 
#> caching of data, set `options(tigris_use_cache = TRUE)` in your R script or .Rprofile.
#> 
#> Attaching package: 'tigris'
#> The following object is masked from 'package:graphics':
#> 
#>     plot
library(sp)
library(sf)
#> Linking to GEOS 3.6.1, GDAL 2.1.3, proj.4 4.9.3

usa_states_sp = states(cb = TRUE, resolution = "20m")
#> 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |=                                                                |   1%
  |                                                                       
  |======                                                           |   9%
  |                                                                       
  |=========                                                        |  13%
  |                                                                       
  |==============                                                   |  22%
  |                                                                       
  |===============                                                  |  23%
  |                                                                       
  |===================                                              |  29%
  |                                                                       
  |========================                                         |  37%
  |                                                                       
  |===========================                                      |  42%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |===================================                              |  54%
  |                                                                       
  |=========================================                        |  63%
  |                                                                       
  |===========================================                      |  67%
  |                                                                       
  |=================================================                |  75%
  |                                                                       
  |====================================================             |  79%
  |                                                                       
  |=========================================================        |  88%
  |                                                                       
  |============================================================     |  92%
  |                                                                       
  |=================================================================| 100%
usa_states_sf = st_as_sf(usa_states_sp) %>% st_transform(crs = 4326)

leaflet() %>% addProviderTiles("Stamen.Toner") %>% addPolylines(data = usa_states_sp)

leaflet() %>% addProviderTiles("Stamen.Toner") %>% addPolylines(data = usa_states_sf)

PR task list:

  • Update NEWS

@schloerke schloerke merged commit 8d54fd4 into rstudio:master Apr 6, 2018
@schloerke schloerke deleted the multi_polyline branch April 13, 2018 14:49
@schloerke schloerke self-assigned this Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant