I am trying to plot few countries using leaflet but the countries that it is showing is incorrect. Following is my minimal reproducible example:
library(leaflet)
library(maps)
df <- data.frame(name = c("Afghanistan", "Albania" , "Algeria" , "Armenia"),
code = c("AFG", "ALB", "DZA", "ARM"),
val = c(5, 10, 15, 20), stringsAsFactors = FALSE)
pal <- colorNumeric(
palette = "Blues",
domain = as.numeric(df$val))
labels <- sprintf(
"<strong>Country:%s</strong><br/>Value:%g /",
df$name, df$val)%>% lapply(htmltools::HTML)
Country = map("world", fill = TRUE, plot = FALSE, regions=iso.expand(df$code,regex = TRUE))
leaflet(Country) %>% addTiles() %>%
addPolygons(fillOpacity = 0.6, smoothFactor = 0.5, stroke = TRUE, weight = 1,
color = ~pal(as.numeric(df$val)),
label = labels)
I get the following leaflet with this:
As you can see Algeria is shown as Albania. If I remove the Armenia from my data and plot the leaflet I get correct location. Following is the code and image for that.
library(leaflet)
library(maps)
df <- data.frame(name = c("Afghanistan", "Albania" , "Algeria" ),
code = c("AFG", "ALB", "DZA"),
val = c(5, 10, 15), stringsAsFactors = FALSE)
pal <- colorNumeric(
palette = "Blues",
domain = as.numeric(df$val))
labels <- sprintf(
"<strong>Country:%s</strong><br/>Value:%g /",
df$name, df$val)%>% lapply(htmltools::HTML)
Country = map("world", fill = TRUE, plot = FALSE, regions=iso.expand(df$code,regex = TRUE))
leaflet(Country) %>% addTiles() %>%
addPolygons(fillOpacity = 0.6, smoothFactor = 0.5, stroke = TRUE, weight = 1,
color = ~pal(as.numeric(df$val)),
label = labels)
Am I missing something?
I think the issue is related to the polygons order in map object (if you set label = Country$names, the labels are now correct). Anyway, you can solve the problem by converting Country into a SpatialPolygons object (see here).
library(maptools)
IDs <- sapply(strsplit(Country$names, ":"), function(x) x[1])
Country <- map2SpatialPolygons(Country,
IDs=IDs,
proj4string=CRS("+proj=longlat +datum=WGS84"))
leaflet(Country) %>% addTiles() %>%
addPolygons(fillOpacity = 0.6, smoothFactor = 0.5, stroke = TRUE, weight = 1,
color = pal(as.numeric(df$val)),
label = labels)
Related
I would like to ask how to calculate number of point that are in some region when we have longtitue and latitude variables of point and polygon of country and its regions.
I provided example below:
I would like to calculate how many point are in what regions (including zero when there is no point) and than add this variables to data2#data object so one can use count measures to fill each regions polygons.
library(leaflet)
library(tidyverse)
set.seed(101)
URL2 <- "https://biogeo.ucdavis.edu/data/gadm3.6/Rsp/gadm36_FRA_2_sp.rds"
data2 <- readRDS(url(URL2))
URL3 <- "https://biogeo.ucdavis.edu/data/gadm3.6/Rsp/gadm36_ESP_2_sp.rds"
data3 <- readRDS(url(URL3))
URL4 <- "https://biogeo.ucdavis.edu/data/gadm3.6/Rsp/gadm36_PRT_2_sp.rds"
data4 <- readRDS(url(URL4))
URL5 <- "https://biogeo.ucdavis.edu/data/gadm3.6/Rsp/gadm36_GBR_2_sp.rds"
data5 <- readRDS(url(URL5))
random_long_lat <-
data.frame(
long = sample(runif(300, min = -2.5, max = 15.99), replace = F),
lat = sample(runif(300, min = 42.69, max = 59.75), replace = F)
)
all <- rbind(data2, data3, data4, data5)
leaflet() %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data=all, stroke = TRUE, color = "black", weight="", smoothFactor = 0.95,
fill = F) %>%
addCircles(lng = random_long_lat$long, lat = random_long_lat$lat)
# Here add new variable called count, that would count how many point are in the region
all#data
I would like the result so one can calculate something like this:
all#data <-
all#data %>%
mutate(counts = rnorm(nrow(all), 100, sd = 20))
cuts <- c(0, 5, 20, 40, 80, 150, max(all#data$counts))
cuts <- colorBin("Greens", domain = all$counts, bins = cuts)
leaflet() %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data=all, stroke = TRUE, color = "white", weight="", smoothFactor = 0.95,
fillOpacity = 0.65, fillColor = ~cuts(all$counts)) %>%
addLegend(pal = cuts,
values = all$counts,
labFormat = labelFormat(suffix = " "),
opacity = 0.85, title = "How many point were counted in each region", position = "topright")
however I dont know is it posible to calculate number of point in each regions having just coordinances?
If you transform the points and France polygons to sf objects, you can use st_intersects() to count the number of points in each polygon.
Note that I updated your sample points so that each quintile break in cuts is unique. With your original data, the first three quintiles were just 0 so the coloring in the leaflet map didn't work.
new sample data
library(leaflet)
library(tidyverse)
set.seed(101)
URL2 <- "https://biogeo.ucdavis.edu/data/gadm3.6/Rsp/gadm36_FRA_2_sp.rds"
data2 <- readRDS(url(URL2))
random_long_lat <-
data.frame(
long = sample(runif(1000, min = -2.5, max = 5.99), replace = F),
lat = sample(runif(1000, min = 42.69, max = 49.75), replace = F)
)
make sf objects and count points in polygons
library(sf)
data_sf <- data2 %>% st_as_sf()
random_long_lat_sf <- random_long_lat %>%
st_as_sf(coords = c("long", "lat"), crs = 4326)
data_sf_summary <- data_sf %>%
mutate(counts = lengths(st_intersects(., random_long_lat_sf)))
define breaks for legend and draw map
cuts <- quantile(data_sf_summary$counts, probs = seq(0, 1, 0.2))
cuts <- colorBin("Greens", domain = data_sf_summary$counts, bins = cuts)
leaflet() %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data=data_sf_summary, stroke = TRUE, color = "white", weight="", smoothFactor = 0.95,
fillOpacity = 0.65, fillColor = ~cuts(data_sf_summary$counts)) %>%
addLegend(pal = cuts,
values = data_sf_summary$hdp,
labFormat = labelFormat(suffix = " "),
opacity = 0.85, title = "How many point were counted in each region", position = "topright")
Also note that tmap package, which lets you switch between static and interactive maps using the same syntax (which resembles ggplot syntax).
same map with tmap:
library(tmap)
tmap_mode("view") # make map interactive
tm_shape(data_sf_summary) +
tm_polygons(col = "counts",
n = 5,
palette = "Greens",
title = "How many point were counted in each region")
static map with tmap:
library(tmap)
tmap_mode("plot") # make map static
tm_shape(data_sf_summary) +
tm_polygons(col = "counts",
n = 5,
palette = "Greens",
title = "How many point were counted in each region") +
tm_layout(legend.position = c("right","top"))
For multiple countries
First create new sample points that cover Europe:
random_long_lat <-
data.frame(
long = sample(runif(1000, min = -7.5, max = 19.99), replace = F),
lat = sample(runif(1000, min = 38.69, max = 60.75), replace = F)
)
all <- rbind(data2, data3, data4, data5)
Then make the sf objects and find the counts of points in every polygon:
all_sf <- all %>% st_as_sf()
random_long_lat_sf <- random_long_lat %>%
st_as_sf(coords = c("long", "lat"), crs = 4326)
all_sf_summary <- all_sf %>%
mutate(counts = lengths(st_intersects(., random_long_lat_sf)))
qtm(random_long_lat_sf)
Option 1: Choose maps from a list object by name using the NAME_0 column.
tmap_mode("view") # make maps interactive
list_of_maps <- map(unique(all_sf_summary$NAME_0),
~ tm_shape(all_sf_summary %>%
filter(NAME_0 == .x)) + # filter the data for your country of interest
tm_polygons(col = "counts",
n = 5,
palette = "Greens",
alpha = 0.85,
border.col = NA,
title = "How many point were counted in each region") +
tm_layout(legend.position = c("right","top"))) %>%
set_names(unique(all_sf_summary$NAME_0))
list_of_maps[['France']]
list_of_maps[['Portugal']]
Option 2: Show all the maps at once
### all maps at once
tm_shape(all_sf_summary) + # filter the data for your country of interest
tm_polygons(col = "counts",
n = 5,
palette = "Greens",
alpha = 0.85,
border.col = NA,
title = "How many point were counted in each region") +
tm_layout(legend.position = c("right","top")) +
tm_facets(by = c("NAME_0"), ncol = 2, showNA = FALSE)
So i'm trying to include some numeric figures in my label but am struggling to get it in the correct accounting format so that it is consistent with the legend. I have no trouble producing the labels without any numeric formatting, so any help in achieving the desired thousands separator would be brilliant.
library(geojson)
library(geojsonio)
library(leaflet)
library(sf)
url <- "http://leafletjs.com/examples/choropleth/us-states.js"
doc <- readLines(url)
doc2 <- gsub("var statesData = ", "", doc)
write(doc2, file = "tempgeo.json")
states <- geojson_read("tempgeo.json", what = "sp")
bins <- c(0, 10000, 20000, 50000, 100000, 200000, 500000, 1000000, Inf)
pal <- colorBin("YlOrRd", domain = states$density, bins = bins)
states$density <- states$density*1000
c <- leaflet(states) %>%
setView(-96, 37.8, 4) %>%
addProviderTiles("MapBox", options = providerTileOptions(
id = "mapbox.light",
accessToken = Sys.getenv('MAPBOX_ACCESS_TOKEN')))
labels <- sprintf(
"<strong>%s</strong><br/>%g",
states$name, states$density
) %>% lapply(htmltools::HTML)
c <- c %>% addPolygons(
fillColor = ~pal(density),
weight = 2,
opacity = 1,
color = "white",
dashArray = "3",
fillOpacity = 0.7,
highlight = highlightOptions(
weight = 5,
color = "#666",
dashArray = "",
fillOpacity = 0.7,
bringToFront = TRUE),
label = labels,
labelOptions = labelOptions(
style = list("font-weight" = "normal", padding = "3px 8px"),
textsize = "15px",
direction = "auto")) %>%
addLegend(pal = pal, values = ~density, opacity = 0.7, title = NULL,
position = "bottomright")
c
Thank you
You can convert the label to a string, and use prettyNum to format it with commas.
labels <- sprintf(
"<strong>%s</strong><br/>%s",
states$name, prettyNum(states$density, big.mark = ",")
) %>% lapply(htmltools::HTML)
I have successfully managed to recreate the drive time polygon in R using This Example Post
The above post only deals with ONE single polygon with isochrones
Problem - I want to plot MULTIPLE drive time polygons on 5 different map points
I have managed to do this in a VERY laborious fashion by creating 5 seperate isochrones, and then adding 5 polygons to my Leaflet Map
#Preparing multiple dependancies----
packages <- c("readxl","dplyr","leaflet","htmltools", "sp", "osrm")
install.packages(packages)
lapply(packages, library,character.only=TRUE)
###
#Loading in Locations----
Location <- read_excel("filepath.xlsx", sheet=1)
###
#Extract Lon and Lat and create spatial dataframe
xy <- Location[, c(3,4)]
spatialdf <- SpatialPointsDataFrame(coords = xy, data = Location, proj4string = CRS("+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"))
class(spatialdf)
#Create Isochrone points
iso1 <- osrmIsochrone(loc = c(-2.3827439,53.425705), breaks = seq(from = 0, to = 60, by = 5))
iso2 <- osrmIsochrone(loc = c(-0.85074928,51.325871), breaks = seq(from = 0, to = 60, by = 5))
iso3 <- osrmIsochrone(loc = c(-2.939367,51.570344), breaks = seq(from = 0, to = 60, by = 5))
iso4 <- osrmIsochrone(loc = c(-3.9868026,55.823102), breaks = seq(from = 0, to = 60, by = 5))
iso5 <- osrmIsochrone(loc = c(-0.92104073,53.709006), breaks = seq(from = 0, to = 60, by = 5))
#Create Drive Time Interval descriptions
iso1#data$drive_times <- factor(paste(iso1#data$min, "to", iso1#data$max, "mins"))
iso2#data$drive_times <- factor(paste(iso2#data$min, "to", iso2#data$max, "mins"))
iso3#data$drive_times <- factor(paste(iso3#data$min, "to", iso3#data$max, "mins"))
iso4#data$drive_times <- factor(paste(iso4#data$min, "to", iso4#data$max, "mins"))
iso5#data$drive_times <- factor(paste(iso5#data$min, "to", iso5#data$max, "mins"))
#Create Colour Palette for each time interval
factPal1 <- colorFactor(rev(heat.colors(12)), iso1#data$drive_times)
factPal2 <- colorFactor(rev(heat.colors(12)), iso2#data$drive_times)
factPal3 <- colorFactor(rev(heat.colors(12)), iso3#data$drive_times)
factPal4 <- colorFactor(rev(heat.colors(12)), iso4#data$drive_times)
factPal5 <- colorFactor(rev(heat.colors(12)), iso5#data$drive_times)
#Draw Map
leaflet()%>%
addProviderTiles("CartoDB.Positron", group="Greyscale")%>%
addMarkers(data=spatialdf,lng=spatialdf$Longitude, lat=spatialdf$Latitude, popup = htmlEscape(~`Locate`))%>%
addPolygons(fill = TRUE, stroke = TRUE, color = "black",fillColor = ~factPal1(iso1#data$drive_times), weight = 0.5, fillOpacity = 0.2, data=iso1, popup = iso1#data$drive_times, group = "Drive Time")%>%
addPolygons(fill = TRUE, stroke = TRUE, color = "black",fillColor = ~factPal2(iso2#data$drive_times), weight = 0.5, fillOpacity = 0.2, data=iso2, popup = iso2#data$drive_times, group = "Drive Time")%>%
addPolygons(fill = TRUE, stroke = TRUE, color = "black",fillColor = ~factPal3(iso3#data$drive_times), weight = 0.5, fillOpacity = 0.2, data=iso3, popup = iso3#data$drive_times, group = "Drive Time")%>%
addPolygons(fill = TRUE, stroke = TRUE, color = "black",fillColor = ~factPal4(iso4#data$drive_times), weight = 0.5, fillOpacity = 0.2, data=iso4, popup = iso4#data$drive_times, group = "Drive Time")%>%
addPolygons(fill = TRUE, stroke = TRUE, color = "black",fillColor = ~factPal5(iso5#data$drive_times), weight = 0.5, fillOpacity = 0.2, data=iso5, popup = iso5#data$drive_times, group = "Drive Time")%>%
addLegend("bottomright", pal = factPal1, values = iso1#data$drive_times, title = "Drive Time")
Not sure why i cannot just refer to the Spatial dataframe that i made ? like this...
iso <- osrmIsochrone(loc = c(spatialdf$Longitude,spatialdf$Latitude), breaks = seq(from = 0, to = 60, by = 5))
This gives me the error: break values do not fit the raster values
and then just use 1 polygon to map all of them? like this...
leaflet()%>%
addProviderTiles("CartoDB.Positron", group="Greyscale")%>%
addMarkers(data=spatialdf,lng=spatialdf$Longitude, lat=spatialdf$Latitude, popup = htmlEscape(~`Locate`))%>%
addPolygons(fill = TRUE, stroke = TRUE, color = "black",fillColor = ~factPal(iso#data$drive_times), weight = 0.5, fillOpacity = 0.2, data=iso, popup = iso#data$drive_times, group = "Drive Time")%>%
addLegend("bottomright", pal = factPal, values = iso#data$drive_times, title = "Drive Time")
Consider a DRY-er (i.e., Don't Repeat Yourself) approach by building a list of items and then iterate through the piping chain:
# LIST OF COORDS
loc_list <- list(c(-2.3827439, 53.425705), c(-0.85074928, 51.325871),
c(-2.939367,51.570344), c(-3.9868026, 55.823102),
c(-0.92104073, 53.709006))
isoc_items <- lapply(loc_list, function(i) {
iso <- osrmIsochrone(loc = i, breaks = seq(from = 0, to = 60, by = 5))
iso#data$drive_times <- factor(paste(iso#data$min, "to", iso#data$max, "mins"))
# NAMED LIST OF TWO ITEMS
list(iso = iso, factPal = colorFactor(rev(heat.colors(12)), iso#data$drive_times))
})
leaflet()%>%
addProviderTiles("CartoDB.Positron", group="Greyscale")%>%
addMarkers(data = spatialdf, lng = spatialdf$Longitude,
lat = spatialdf$Latitude, popup = htmlEscape(~`Locate`))%>%
# ITERATE TO ADD POLYGONS
for (item in isoc_items) {
addPolygons(fill = TRUE, stroke = TRUE, color = "black",
fillColor = ~item$factPal(item$iso#data$drive_times),
weight = 0.5, fillOpacity = 0.2, data = item$iso,
popup = item$iso#data$drive_times, group = "Drive Time")%>%
}
addLegend("bottomright", pal = isoc_items[[1]]$factPal,
values = isoc_items[[1]]$iso#data$drive_times, title = "Drive Time")
#Parfait has a good use of lapply that I would keep, so I won't recreate it for my answer. For your question of only looking to refer to one spatial polygon dataframe in your call to addPolygon you can use rbind once they are created. Note this only uses one colorFactor set.
#Create Isochrone points
iso1 <- osrmIsochrone(loc = c(-2.3827439,53.425705), breaks = seq(from = 0, to = 60, by = 5))
iso2 <- osrmIsochrone(loc = c(-0.85074928,51.325871), breaks = seq(from = 0, to = 60, by = 5))
iso3 <- osrmIsochrone(loc = c(-2.939367,51.570344), breaks = seq(from = 0, to = 60, by = 5))
iso4 <- osrmIsochrone(loc = c(-3.9868026,55.823102), breaks = seq(from = 0, to = 60, by = 5))
iso5 <- osrmIsochrone(loc = c(-0.92104073,53.709006), breaks = seq(from = 0, to = 60, by = 5))
iso <- rbind(iso1, iso2,iso3,iso4,iso5)
#Create Drive Time Interval descriptions
iso#data$drive_times <- factor(paste(iso#data$min, "to", iso#data$max, "mins"))
#Create Colour Palette for each time interval
factPal <- colorFactor(rev(heat.colors(12)), iso#data$drive_times)
#Draw Map
leaflet()%>%
addProviderTiles("CartoDB.Positron", group="Greyscale")%>%
# addMarkers(data=spatialdf,lng=spatialdf$Longitude, lat=spatialdf$Latitude, popup = htmlEscape(~`Locate`))%>%
addPolygons(fill = TRUE, stroke = TRUE, color = "black",fillColor = ~factPal(iso#data$drive_times), weight = 0.5, fillOpacity = 0.2, data=iso, popup = iso#data$drive_times, group = "Drive Time") %>%
addLegend("bottomright", pal = factPal, values = iso#data$drive_times, title = "Drive Time")
I have a plotly based graph in R and I wish to display it on my github pages. I am not able to display the graph when I convert into to markdown. I was able to render an html of plotly plot, but I dont know how to use with pages.Here is my rep and file for the below markdown
library(XML)
library(ggplot2)
library(tidyr)
library(dplyr)
library('maps')
library('ggthemes')
library('plotly')
A_loc<-tbl_df(readLines("https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat"))
New_A_loc<-as.data.frame(sapply(A_loc, function(x) gsub("\"", "", x)))
New_A_loc<-separate(data = New_A_loc, col = value, into = c("Airport_id", "Name","City","Country","IATA","ICAO","Lat","Long","Alt","Timezone","DST","TZ","Type","Source"), sep = ",")
New_A_loc$Lat <- as.numeric(New_A_loc$Lat)
New_A_loc$Long <- as.numeric(New_A_loc$Long)
New_A_loc$Alt<-as.numeric(New_A_loc$Alt)
New_A_loc$Name<-as.character(New_A_loc$Name)
g <- list(showframe = FALSE,
coastlinecolor = toRGB("white"),
showland = TRUE,
landcolor = toRGB("gray80"),
showcountries = TRUE,
countrycolor = toRGB("white"),
countrywidth = 0.2,
projection = list(type = 'Mercator'))
plot_geo(New_A_loc,
lat = ~Lat,
lon = ~Long,
text = ~City,
mode='markers',
marker = list(color = toRGB("purple"),
opacity = 0.5,
line = list(color = toRGB("purple"),
width = 0.5))
) %>%
layout(geo = g) %>% htmlwidgets::saveWidget("New_2.html")
I'm trying to make a simple map with Leaflet in R Markdown. I used standard deviation classification method to divide the data into 4 classes. When it produces the map, the colors on the map appear much lighter than what they should be. What is the problem here ? Thank you!
library(rgdal)
library(leaflet)
library(readr)
STCOU<- readOGR("H:/SP/STCOU.shp", "STCOU", GDAL1_integer64_policy = TRUE)
UNGEOCODED <- read_csv("H:/SP/UNGEOCODED.csv")
palette1 <- colorBin(c('#f1eef6','#bdc9e1','#74a9cf','#0570b0'),bins = c(0,1600, 3400, 5200, 32000),pretty = FALSE)
palette2 <- colorBin(c('#ece7f2','#a6bddb','#2b8cbe'),bins = c(0,1816, 3821, 35781),pretty = FALSE)
popup1<-paste("2015 Ungeocoded Tallies",
"<br>GEO_ID: ",
STCOU$GEOID,
"<br>State: ",
STCOU$STATEFP,
"<br>County: ",
STCOU$COUNTYFP,
"<br>Name: ",
STCOU$NAME,
"<br>LSAD: ",
STCOU$LSAD,
"<br>CensusArea: ",
STCOU$ALAND,
"<br>Current_UNGEO_Counts: ",
STCOU$CURRENT_UN,
"<br>Fall15_UNGEO_Counts: ",
STCOU$FAL15_UNGE)
popup2<-paste("2016 Ungeocoded Tallies",
"<br>GEO_ID: ",
STCOU$GEOID,
"<br>State: ",
STCOU$STATEFP,
"<br>County: ",
STCOU$COUNTYFP,
"<br>Name: ",
STCOU$NAME,
"<br>LSAD: ",
STCOU$LSAD,
"<br>CensusArea: ",
STCOU$ALAND,
"<br>Current_UNGEO_Counts: ",
STCOU$CURRENT_UN,
"<br>Fall15_UNGEO_Counts: ",
STCOU$FAL16_UNGE)
```
### Ungeocoded 2015 2016
```{r}
leaflet() %>%
setView(lng = -94.308561, lat = 38.561161, zoom=5) %>%
addProviderTiles("Esri.WorldGrayCanvas",
options = tileOptions()) %>%
addPolygons(data=STCOU,weight=0.1,
fillColor = ~palette1(UNGEOCODED$FAL15_UNGE),
popup = popup1,
group="<span style='color: #7f0000; font-size: 11pt'><strong>2015</strong></span>")%>%
addPolygons(data=STCOU,weight=0.1,
fillColor = ~palette2(UNGEOCODED$SPR16_UNGE),
popup=popup2,
group="2016") %>%
addLayersControl(baseGroups = c("<span style='color: #7f0000; font-size: 11pt'><strong>2015</strong></span>",
"2016"), options = layersControlOptions(collapsed =FALSE))%>%
addLegend(position = 'topleft',
colors = c('#f1eef6','#bdc9e1','#74a9cf','#0570b0'),
labels = c('Low'," "," ","High"),
opacity = 0.6,
title = "2015 2016 Ungeocoded")
```
Basically you just need to read the docs on the various addLayers functions in leaflet package and you'll see that fillOpacity is set to 0.2 as the default. This is to save you from yourself when features overlap, but you can definitely set the parameter higher, i.e.
Minimal Reproducible Example + Answer -->
library(leaflet)
df <- data.frame(
lon = sample(seq(-94.9, -93.1, 0.00001), 10, replace = T),
lat = sample(seq(38.1, 39.9, 0.00001), 10, replace = T),
value = sample(density(c(0,1600, 3400, 5200, 32000))$x, 10)
)
palette1 <- colorBin(c('#f1eef6','#bdc9e1','#74a9cf','#0570b0'), bins = c(0,1600, 3400, 5200, 32000), pretty = FALSE)
leaflet(df) %>%
setView(lng = -94.308561, lat = 38.561161, zoom=7) %>%
addProviderTiles("Esri.WorldGrayCanvas") %>%
addCircleMarkers(
weight=0.1,
fillOpacity = 0.7,
fillColor = ~palette1(value)
)