leaflet-extras/leaflet-providers

Error when loading Hydda overlay in R tmap script

Closed this issue · 1 comments

I am not sure if this is an error with leaflet, tmap or hydda, but I'm posting it here as a first step!

I have an R script creating maps using tmap that has previously been working fine until recently it has started giving me an error. I have a tmap statement

outlines <- tm_shape(by_ward) + tm_polygons(col = "ward")

which generates a map perfectly well with no errors (by_ward is created from UK OA shapefile data that is grouped according to the variable "ward" using dplyr::group_by and dplyr::summarise).

basic success
If I do:

tmap_options_reset()
outlines

I get my map - but of course with no basemap or overlay.

error
If I do:
tmap_options_reset()
tmap_options(basemaps = leaflet::providers$Hydda.Base,
overlays = leaflet::providers$Hydda.RoadsAndLabels)
outlines

...then I get the error:

Error in mapply(function(a, tmsi) { :
zero-length inputs cannot be mixed with those of non-zero length

non-error variation
If I do:
tmap_options_reset()
tmap_options(basemaps = leaflet::providers$Hydda.Base)
outlines

...I don't get the error. The map renders fine. But I need the overlay! So...

proof of location of error
And if I do:
tmap_options_reset()
tmap_options(basemaps = leaflet::providers$OpenStreetMap.Mapnik,
overlays = leaflet::providers$Hydda.RoadsAndLabels)
outlines

...then I get the mapply error again, same as above.

I have lots of other tmap_options set usually, but I have removed all of them in order to discover which one is causing the error, and it seems to be the Hydda overlays option that causes it.

I've decided this is a tmap problem and have filed an issue here instead.