keatonwilson / paleotidal_app

Shiny app for paleotidal modeling for Exeter + Bangor
1 stars 0 forks source link

Fix NA land mask #66

Closed jessicaguo closed 1 year ago

jessicaguo commented 1 year ago

@keatonwilson I delved into this issue, and it seems that the problem isn't with the land mask location nor with the raster function 'first', which I had thought was responsible. It looks to be a categorical raster projection issue with leaflet?

See: https://github.com/rstudio/leaflet/issues/224 and https://github.com/rstudio/leaflet/issues/219

I can set project = FALSE in AddRasterImage(), which fixes the NAs between category levels but then does another crazy thing. Can you take a look at how to get the projection correct for categorical rasters, then add that solution to mod_map.R?

I think/hope we're on the right path with this! Also fixed a small bug with the paleocoast, it can now go to 0 BP without crashing.

keatonwilson commented 1 year ago

@jessicaguo I made some commits that I think did the trick. I just ran the nearest-neighbor projection method for all the Strat rasters in the stack via leaflet::projectRasterForLeaflet(method = "ngb") - seemed to do the trick. Good sleuthing on this one!

Feel free to merge if it looks good!

jessicaguo commented 1 year ago

Hooray! Thanks for completing the last bit of this. It looks much better now.