Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with adding wind data to AddVelocity() in leaflet.extras2 #2

Open
cookalex77 opened this issue Jun 12, 2020 · 1 comment
Open
Labels
help wanted ❤️ we'd love your help!

Comments

@cookalex77
Copy link

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

@trafficonese
Copy link
Owner

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.

@trafficonese trafficonese added help wanted ❤️ we'd love your help! and removed help wanted labels Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted ❤️ we'd love your help!
Projects
None yet
Development

No branches or pull requests

2 participants