Open cookalex77 opened 4 years ago
Hey, unfortunately this is not very straightforward. You would have to look at the demos of https://github.com/danwild/leaflet-velocity or the code at https://github.com/danwild/wind-js-server.
It basically transforms GRIB2 data to JSON, but since you and wind-js-server
use NOAA data, it should be possible.
Hi, I am trying to use the AddVelocity function in the leaflet.extras2 package in R so that I can add wind velocity visualization data to my leaflet map. I have found JSON u and v wind data from NOAA, but I cant seem to successfully add my wind velocity data using the content=. Any suggestions on how to format the json data so that AddVelocity can process it into an animation? The code below runs in R, but no wind arrows or animation is produced, just the base map appears. Any help would be much appreciated!
content<-"https://pae-paha.pacioos.hawaii.edu/erddap/griddap/ncep_global.json?ugrd10m%5B(2020-06-16T12:00:00Z)%5D%5B(-23.5):(80.0)%5D%5B(219.0):(323.5)%5D&.draw=surface&.vars=longitude%7Clatitude%7Cugrd10m&.colorBar=%7C%7C%7C%7C%7C&.bgColor=0xffccccff"
leaflet() %>% addTiles(group = "base") %>% setView(-71,42,5) %>% leaflet.extras2::addVelocity(content =content ,group = "velo", layerId = "veloid")
Site with wind data :https://pae-paha.pacioos.hawaii.edu/erddap/griddap/ncep_global.graph?tmpsfc[(2011-05-07T00:00:00Z)][(34.625):(46.875)][(283.125):(295.375)],tmp2m[(2011-05-07T00:00:00Z)][(34.625):(46.875)][(283.125):(295.375)]&.draw=vectors&.vars=longitude%7Clatitude%7Ctmpsfc%7Ctmp2m&.color=0x000000&.bgColor=0xffccccff