Skip to content
Prev 28712 / 29559 Next

question on the use of Leaflet for plotting points and rater GeoTIFF

Dear Ben,

Thanks a lot for your help!
Actually it worked very well for me with the link you gave me.
However, for some reason the numbers of the values in color scale goes from
the lower values set at the top  (blue) of the sacale to the higher values
set at the bottom (red ) and it would be better for me if it goes from from
the lower values in the bottom (blue) to higher value in the top (red),
since is temperature going from the lower to the higher.
 Another issue I found a bit problematic for me to modify is that the color
palette is too "light", for instance not like the color palette "Jet" in
Matlab or Python, it seems as if the intensity of the colors of the
temperature colors is low or light maybe is a transparency and should
change opacity ....?

Maybe you or somebody knows a possible way to improve these two issues a
bit ?

Here is the code :

# color palettes
# pal <- colorNumeric(palette = "Spectral", values(raster), na.color =
"transparent" , reverse = TRUE)
pal <- colorNumeric(palette = "RdYlBu", values(raster), na.color =
"transparent" , reverse = TRUE)

# plot map
leaflet() %>%
  addTiles(urlTemplate = "
https://mts1.google.com/vt/lyrs=s&hl=en&src=app&x={x}&y={y}&z={z}&s=G",
attribution = 'Google')  %>%
  addPolygons(data = polygon,weight=5,col = 'black')  %>%
  addCircles(data = points, color = "White", radius = 500, fillOpacity =
1,opacity = 9)%>%
  addRasterImage(raster, project = FALSE, colors = pal) %>%
  addLegend(pal = pal, values = values(raster), title = "Temperature",
opacity = 9)  # ,labFormat = labelFormat(transform = function(x) sort(x,
decreasing = TRUE)))

Thanks a lot again for your help.
Kind regards,
Gabriel
On Thu, Aug 12, 2021 at 5:07 PM Ben Tupper <btupper at bigelow.org> wrote: