-
Notifications
You must be signed in to change notification settings - Fork 2
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
Create a map detailing study site and oceanographic features #3
Comments
These days I would start with leaflet. https://rstudio.github.io/leaflet/ First though: "what oceanographic features"? Unfortunately there's no obvious collection of the main things, but we can look at Note we have library(orsifronts) ## install. packages("orsifronts")
library(leaflet) ## install.packages("leaflet")
## orsifronts is a SpatialPolygonsDataFrame (could be read via shapefile, or contoured from other data)
data(orsifronts)
fronts_as_points <- as(orsifronts, "SpatialPointsDataFrame")
fronts_as_points <- fronts_as_points[sample(nrow(fronts_as_points), 20), ]
leaflet() %>% addProviderTiles(providers$Esri.NatGeoWorldMap) %>%
addPolylines(data = rmapshaper::ms_simplify(orsifronts),
color = ~colorFactor(viridis::viridis(nrow(orsifronts)), front)(front)) %>%
addMarkers(data = fronts_as_points, label = ~front, labelOptions = labelOptions(noHide = TRUE))
(I had to simplify the fronts layer to get it to work, and I don't know why. ) We can talk about how to plot this more traditionally, but I think the key is getting familiarity with plotting map stuff generally. In R we need sp and raster, everything else comes from those kinds of objects. |
title: "Making a general Southern Ocean map"
|
I've had a crack at a southern ocean map that may be helpful. But I think the leaflet option is going to be a better way to go. |
This is wonderful |
Saturday night R fever! Hopefully, a few in the lab can use it...and improve it. Time for a beer. |
I made some small changes and added it as .Rmd file to this repo, you can see the changes using the history feature: They are
We should capture this as a tool to trot out more easily, and I'm happy to do that. I think this is a good example of the kinds of shared-needs we can work on together. We might be able to get the labels out of antanym, and @raymondben will have better ideas about that. Nice one! |
Notes for myself, use this for rewriting the lab-mods: https://gist.github.com/hrbrmstr/8c7862092681d06e6535ab38d03074bf (it's not relevant to the map, but it's a tool to help rewrite the code in a more readable form). tribble ftw |
Hey @mdsumner, Mind my noob status here. Do I have write access to this code? Still learning GitHub. I'd like to add a polygon to it. This is a common thing we do in the lab and could be included in this example. |
@mdsumner Couldn't change the projection as per recommendations without it falling over... probably use lat_0=-90 for more general maps, it's a bit off-centrepprj <- "+proj=laea +lat_0=-60 +lon_0=180 +datum=WGS84 +ellps=WGS84 +no_defs +towgs84=0,0,0" For others- Up to date map is here: Can we directly raise issues on that code? |
Hey @mdsumner, just wondering if you could offer up your fix to the cropping problem when world map is reprojected into polar stereographic form? Here: https://github.com/DataScienceHobart/2017-02-03-graphics-imas/blob/master/making-general-socean-map.rmd |
Try this, crop after reproject https://gist.github.com/mdsumner/3da004f9df5ad30811641bbcbf3fb9e0 The crop should insert a segmentized arc (from the circular buffer) to carry the parallel at the northern edge. |
Hi Mike,
I'm posting this one for someone else (they're having issues with GitHub). How can we create a really nice map to show a study site, including oceanographic features etc?
thanks
The text was updated successfully, but these errors were encountered: