I am trying to add ocean color to a leaflet map without calling addTiles(). Effectively I want a simple map, generated by a shapefile, without all the extra data that comes from the addTiles() layer.
I can change the colors of areas marked in the shapefile by access characteristics in the @data slot. But how do I change colors for everything outside of that?
Here is an example:
#Load libraries
library('rgdal')
library('leaflet')
#Create save location
dir.create('DATA')
#Download and unzip file
download.file(url = 'http://thematicmapping.org/downloads/TM_WORLD_BORDERS_SIMPL-0.3.zip',
destfile = 'DATA/world_shape_file.zip')
unzip(zipfile = 'DATA/world_shape_file.zip',
exdir = 'DATA')
#Create spdf
world_spdf <- readOGR('DATA/TM_WORLD_BORDERS_SIMPL-0.3.shp')
#plot spdf
leaflet() %>%
addPolygons(data = world_spdf,
weight = 0.5,
color = 'grey',
fillColor = 'white')
Calling this generates an image of the ocean as grey. I want to be able to set this to a shade of blue. Seems like it should be simple but all solutions use addTiles() which adds all sorts of name data etc. to my map.