emlab-ucsb / spatialgridr

An R package that allows easy gridding of spatial data. Principally intended for spatial planning uses.
https://emlab-ucsb.github.io/spatialgridr/
GNU General Public License v3.0
1 stars 1 forks source link

Oceans and Seas #25

Open jaseeverett opened 5 months ago

jaseeverett commented 5 months ago

Thanks @jflowernet for adding the option of oceans to the get_boundary(). However it seems to only include major oceans. Can you please add access to all the seas as well? This has been relevant for many students in the past. Alternatively I can keep the equivalent spatialplanr function for the moment.

In spatialplanr we have always used rnaturalearth for this which includes the oceans and the seas etc. I can't see it in mregions2, but perhaps it is there? We want to work in the Coral Sea for example, or just the seas in the Coral Triangle etc.

 if (Type == "Oceans" | Type == "Ocean") {
    Bndry <- rnaturalearth::ne_download(
      scale = "large",
      category = "physical",
      type = "geography_marine_polys",
      returnclass = "sf"
    ) %>%
      dplyr::filter(.data$name %in% Limits) %>%
      sf::st_union() %>%
      sf::st_transform(cCRS) %>%
      sf::st_sf()
    return(Bndry)
  }
jflowernet commented 5 months ago

Yes, can definitely add access to the rnaturalearth marine data - will get this done early next week

jaseeverett commented 5 months ago

This information might be available in mregions2 but I can't see it...

jflowernet commented 5 months ago

There is a pretty detailed dataset on seas and oceans in mregions2 called the SeaVoX Salt and Fresh Water Body Gazetteer, more info in the Marine Regions sources. One issue I've found is downloading the whole lot is quite slow compared to the rnaturalearth data. On the other hand, it is clear about where the data comes from, whereas the Natural Earth marine data doesn't seem to explain how it was created. Also, you can query for a specific sea/ ocean with the mregions2 data, whereas for Natural Earth, you'd have to download the whole dataset (which is admittedly relatively small).

What is your preference to include @jaseeverett ? You will the primary user group at the moment, so have your say!

Here's more info about the mregions2 Seavox dataset:

start_time <- Sys.time()

seavox <- mregions2::mrp_get("seavox_v18")

Sys.time() - start_time
#> Time difference of 5.468431 mins

head(seavox)
#> Simple feature collection with 6 features and 20 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -179.9999 ymin: -75.25215 xmax: 180 ymax: 66.37612
#> Geodetic CRS:  WGS 84
#>         sub_region                 region                level_1
#> 1     ADRIATIC SEA   MEDITERRANEAN REGION      MEDITERRANEAN SEA
#> 2       AEGEAN SEA   MEDITERRANEAN REGION      MEDITERRANEAN SEA
#> 3      ALBORAN SEA   MEDITERRANEAN REGION      MEDITERRANEAN SEA
#> 4     AMUNDSEN SEA         SOUTHERN OCEAN                   <NA>
#> 5 ANADYRSKIY ZALIV          PACIFIC OCEAN    NORTH PACIFIC OCEAN
#> 6    BAY OF QUINTE NORTH AMERICA MAINLAND LAURENTIAN GREAT LAKES
#>                            level_2    level_3 level_4
#> 1 MEDITERRANEAN SEA, EASTERN BASIN       <NA>    <NA>
#> 2 MEDITERRANEAN SEA, EASTERN BASIN       <NA>    <NA>
#> 3 MEDITERRANEAN SEA, WESTERN BASIN       <NA>    <NA>
#> 4                             <NA>       <NA>    <NA>
#> 5   NORTHWEST PACIFIC OCEAN (180W) BERING SEA    <NA>
#> 6                     LAKE ONTARIO       <NA>    <NA>
#>                                                   skos_url       lat       long
#> 1  http://vocab.nerc.ac.uk/collection/C19/current/3_1_2_1/  42.72356   16.04228
#> 2  http://vocab.nerc.ac.uk/collection/C19/current/3_1_2_4/  37.85402   25.20097
#> 3  http://vocab.nerc.ac.uk/collection/C19/current/3_1_1_2/  35.91281   -3.32763
#> 4    http://vocab.nerc.ac.uk/collection/C19/current/10_11/ -73.12058 -112.83431
#> 5    http://vocab.nerc.ac.uk/collection/C19/current/7_8_1/  64.25011 -105.01130
#> 6 http://vocab.nerc.ac.uk/collection/C19/current/GTLAK024/  44.11573  -77.15585
#>      minlat    minlong    maxlat    maxlong mrgid_sr mrgid_r mrgid_l1 mrgid_l2
#> 1  39.74305   12.14106  45.79467   20.01792    24092   23621    23628    23635
#> 2  35.11041   22.52698  41.01212   28.72174    24086   23621    23628    23635
#> 3  35.07286   -5.35812  36.84032   -1.19307    24082   23621    23628    23636
#> 4 -75.25215 -126.26120 -72.00002 -100.89602    24146   23624     <NA>     <NA>
#> 5  62.28185 -179.99991  66.37612  180.00000    24121   23622    23630    23640
#> 6  44.00819  -77.59991  44.24561  -76.80589    47901   36274    47890    47895
#>   mrgid_l3 mrgid_l4 area_km2                       geometry
#> 1     <NA>     <NA>   139079 MULTIPOLYGON (((13.54623 45...
#> 2     <NA>     <NA>   190438 MULTIPOLYGON (((25.13754 41...
#> 3     <NA>     <NA>    54393 MULTIPOLYGON (((-2.357396 3...
#> 4     <NA>     <NA>   147242 MULTIPOLYGON (((-102.4124 -...
#> 5    23651     <NA>    85243 MULTIPOLYGON (((180 65.0337...
#> 6     <NA>     <NA>      246 MULTIPOLYGON (((-76.94617 4...

sort(unique(seavox$sub_region))
#>   [1] "ADRIATIC SEA"                                           
#>   [2] "AEGEAN SEA"                                             
#>   [3] "ALBORAN SEA"                                            
#>   [4] "AMUNDSEN SEA"                                           
#>   [5] "ANADYRSKIY ZALIV"                                       
#>   [6] "ANDAMAN SEA"                                            
#>   [7] "ARABIAN SEA"                                            
#>   [8] "ARAFURA SEA"                                            
#>   [9] "ARAL SEA"                                               
#>  [10] "ARCTIC OCEAN"                                           
#>  [11] "ARU SEA"                                                
#>  [12] "ASIAN MAINLAND"                                         
#>  [13] "BAFFIN BAY"                                             
#>  [14] "BALEARIC SEA"                                           
#>  [15] "BALI SEA"                                               
#>  [16] "BANDA SEA"                                              
#>  [17] "BARENTS SEA"                                            
#>  [18] "BARNSTAPLE OR BIDEFORD BAY"                             
#>  [19] "BASS STRAIT"                                            
#>  [20] "BAY OF BENGAL"                                          
#>  [21] "BAY OF BISCAY"                                          
#>  [22] "BAY OF BOTHNIA"                                         
#>  [23] "BAY OF BREST"                                           
#>  [24] "BAY OF FUNDY"                                           
#>  [25] "BAY OF QUINTE"                                          
#>  [26] "BEAUFORT SEA"                                           
#>  [27] "BELFAST LOUGH"                                          
#>  [28] "BELLINGSHAUSEN SEA"                                     
#>  [29] "BERING SEA"                                             
#>  [30] "BERING STRAIT"                                          
#>  [31] "BIG BAY DE NOC"                                         
#>  [32] "BISMARCK SEA"                                           
#>  [33] "BLACK SEA"                                              
#>  [34] "BLACKWATER ESTUARY"                                     
#>  [35] "BO HAI"                                                 
#>  [36] "BOTHNIAN SEA"                                           
#>  [37] "BRANSFIELD STRAIT"                                      
#>  [38] "BRIDGWATER BAY"                                         
#>  [39] "BRIDLINGTON BAY"                                        
#>  [40] "BRISTOL CHANNEL"                                        
#>  [41] "CAERNARFON BAY"                                         
#>  [42] "CARDIGAN BAY"                                           
#>  [43] "CARIBBEAN SEA"                                          
#>  [44] "CARLINGFORD LOUGH"                                      
#>  [45] "CARMARTHEN BAY"                                         
#>  [46] "CASPIAN SEA"                                            
#>  [47] "CELEBES SEA"                                            
#>  [48] "CELTIC SEA"                                             
#>  [49] "CENTRAL BALTIC SEA"                                     
#>  [50] "CERAM SEA"                                              
#>  [51] "CHEQUAMEGON BAY"                                        
#>  [52] "CHRISTCHURCH BAY"                                       
#>  [53] "CHUKCHI SEA"                                            
#>  [54] "COASTAL WATERS OF SOUTHEAST ALASKA AND BRITISH COLUMBIA"
#>  [55] "COOPERATION SEA"                                        
#>  [56] "CORAL SEA"                                              
#>  [57] "COSMONAUTS SEA"                                         
#>  [58] "DAVIS SEA"                                              
#>  [59] "DAVIS STRAIT"                                           
#>  [60] "DEE ESTUARY"                                            
#>  [61] "DETROIT RIVER"                                          
#>  [62] "DORNOCH FIRTH"                                          
#>  [63] "DOVER STRAIT"                                           
#>  [64] "DRAKE PASSAGE"                                          
#>  [65] "DUMONT D'URVILLE SEA"                                   
#>  [66] "EAST CHINA SEA"                                         
#>  [67] "EAST SIBERIAN SEA"                                      
#>  [68] "EASTERN SCHELDT"                                        
#>  [69] "ENGLISH CHANNEL"                                        
#>  [70] "EUROPEAN MAINLAND"                                      
#>  [71] "FIRTH OF CLYDE"                                         
#>  [72] "FIRTH OF FORTH"                                         
#>  [73] "FIRTH OF LORN"                                          
#>  [74] "FIRTH OF TAY"                                           
#>  [75] "FLORES SEA"                                             
#>  [76] "FRAM STRAIT"                                            
#>  [77] "GEORGIAN BAY"                                           
#>  [78] "GRAND TRAVERSE BAY"                                     
#>  [79] "GREAT AUSTRALIAN BIGHT"                                 
#>  [80] "GREAT BARRIER REEF (COASTAL WATERS)"                    
#>  [81] "GREEN BAY"                                              
#>  [82] "GREENLAND SEA"                                          
#>  [83] "GREVELINGEN"                                            
#>  [84] "GULF OF ADEN"                                           
#>  [85] "GULF OF ALASKA"                                         
#>  [86] "GULF OF AQABA"                                          
#>  [87] "GULF OF CALIFORNIA"                                     
#>  [88] "GULF OF CARPENTARIA"                                    
#>  [89] "GULF OF FINLAND"                                        
#>  [90] "GULF OF GUINEA"                                         
#>  [91] "GULF OF MAINE"                                          
#>  [92] "GULF OF MANNAR"                                         
#>  [93] "GULF OF MEXICO"                                         
#>  [94] "GULF OF OMAN"                                           
#>  [95] "GULF OF PANAMA"                                         
#>  [96] "GULF OF PAPUA"                                          
#>  [97] "GULF OF RIGA"                                           
#>  [98] "GULF OF ST. LAWRENCE"                                   
#>  [99] "GULF OF SUEZ"                                           
#> [100] "GULF OF THAILAND"                                       
#> [101] "GULF OF TONKIN"                                         
#> [102] "HALMAHERA SEA"                                          
#> [103] "HARINGVLIET"                                            
#> [104] "HOLLANDS DIEP"                                          
#> [105] "HUDSON BAY"                                             
#> [106] "HUDSON STRAIT"                                          
#> [107] "HUMBER ESTUARY"                                         
#> [108] "ICELAND SEA"                                            
#> [109] "IJSSELMEER"                                             
#> [110] "INDIAN OCEAN"                                           
#> [111] "INNER SEAS OFF THE WEST COAST OF SCOTLAND"              
#> [112] "IONIAN SEA"                                             
#> [113] "IRISH SEA"                                              
#> [114] "JAPAN SEA"                                              
#> [115] "JAWA SEA"                                               
#> [116] "JOSEPH BONAPARTE GULF"                                  
#> [117] "KARA SEA"                                               
#> [118] "KATTEGAT"                                               
#> [119] "KEWEENAW BAY"                                           
#> [120] "KILBRANNAN SOUND"                                       
#> [121] "KRAMMER"                                                
#> [122] "LABRADOR SEA"                                           
#> [123] "LAKE ERIE"                                              
#> [124] "LAKE HURON"                                             
#> [125] "LAKE MICHIGAN"                                          
#> [126] "LAKE ONTARIO"                                           
#> [127] "LAKE ST. CLAIR"                                         
#> [128] "LAKE SUPERIOR"                                          
#> [129] "LAKSHADWEEP SEA"                                        
#> [130] "LAPTEV SEA"                                             
#> [131] "LAZAREV SEA"                                            
#> [132] "LIAODONG WAN"                                           
#> [133] "LIGURIAN SEA"                                           
#> [134] "LILLEBAELT"                                             
#> [135] "LINCOLN SEA"                                            
#> [136] "LITTLE BAY DE NOC"                                      
#> [137] "LITTLE MINCH"                                           
#> [138] "LIVERPOOL BAY"                                          
#> [139] "LONG POINT BAY"                                         
#> [140] "LOUGH FOYLE"                                            
#> [141] "LUCE BAY"                                               
#> [142] "LYME BAY"                                               
#> [143] "MALACCA STRAIT"                                         
#> [144] "MARKERMEER"                                             
#> [145] "MAWSON SEA"                                             
#> [146] "McMURDO SOUND"                                          
#> [147] "MEDITERRANEAN SEA, EASTERN BASIN"                       
#> [148] "MEDITERRANEAN SEA, WESTERN BASIN"                       
#> [149] "MENAI STRAIT"                                           
#> [150] "MERSEY ESTUARY"                                         
#> [151] "MICHIPICOTEN BAY"                                       
#> [152] "MOLUCCA SEA"                                            
#> [153] "MORAY FIRTH"                                            
#> [154] "MORECAMBE BAY"                                          
#> [155] "MOUNTS BAY"                                             
#> [156] "MOZAMBIQUE CHANNEL"                                     
#> [157] "NATUNA SEA"                                             
#> [158] "NIAGARA RIVER"                                          
#> [159] "NORTH AMERICA MAINLAND"                                 
#> [160] "NORTH CHANNEL"                                          
#> [161] "NORTH SEA"                                              
#> [162] "NORTHEAST ATLANTIC OCEAN (40W)"                         
#> [163] "NORTHEAST PACIFIC OCEAN (180W)"                         
#> [164] "NORTHERN MINCH"                                         
#> [165] "NORTHWEST ATLANTIC OCEAN (40W)"                         
#> [166] "NORTHWEST PACIFIC OCEAN (180W)"                         
#> [167] "NORTHWESTERN PASSAGES"                                  
#> [168] "NORWEGIAN SEA"                                          
#> [169] "PALK STRAIT AND PALK BAY"                               
#> [170] "PENTLAND FIRTH"                                         
#> [171] "PERSIAN GULF"                                           
#> [172] "PHILIPPINE SEA"                                         
#> [173] "PLYMOUTH SOUND"                                         
#> [174] "POOLE BAY"                                              
#> [175] "POOLE HARBOUR"                                          
#> [176] "RED SEA"                                                
#> [177] "RIBBLE ESTUARY"                                         
#> [178] "RIISER-LARSEN SEA"                                      
#> [179] "RIO DE LA PLATA"                                        
#> [180] "ROSS SEA"                                               
#> [181] "RYE BAY"                                                
#> [182] "SAGINAW BAY"                                            
#> [183] "SANDUSKY BAY"                                           
#> [184] "SAWU SEA"                                               
#> [185] "SCAPA FLOW"                                             
#> [186] "SCOTIA SEA"                                             
#> [187] "SEA OF AZOV"                                            
#> [188] "SEA OF MARMARA"                                         
#> [189] "SEA OF OKHOTSK"                                         
#> [190] "SEA OF THE HEBRIDES"                                    
#> [191] "SELAT MAKASAR"                                          
#> [192] "SELAT SUMBA"                                            
#> [193] "SELAT SUNDA"                                            
#> [194] "SETO NAIKAI"                                            
#> [195] "SEVERN ESTUARY"                                         
#> [196] "SINGAPORE STRAIT"                                       
#> [197] "SKAGERRAK"                                              
#> [198] "SOLENT"                                                 
#> [199] "SOLOMON SEA"                                            
#> [200] "SOLWAY FIRTH"                                           
#> [201] "SOMOV SEA"                                              
#> [202] "SOUND OF JURA"                                          
#> [203] "SOUND SEA"                                              
#> [204] "SOUTH CHINA AND EASTERN ARCHIPELAGIC SEAS"              
#> [205] "SOUTHEAST ATLANTIC OCEAN (20W)"                         
#> [206] "SOUTHEAST PACIFIC OCEAN (140W)"                         
#> [207] "SOUTHERN OCEAN"                                         
#> [208] "SOUTHWEST ATLANTIC OCEAN (20W)"                         
#> [209] "SOUTHWEST PACIFIC OCEAN (140W)"                         
#> [210] "ST. BRIDES BAY"                                         
#> [211] "ST. CLAIR RIVER"                                        
#> [212] "ST. GEORGE'S CHANNEL"                                   
#> [213] "ST. LOUIS RIVER ESTUARY"                                
#> [214] "ST. MAGNUS BAY"                                         
#> [215] "ST. MARYS RIVER"                                        
#> [216] "STOREBAELT"                                             
#> [217] "STRAIT OF GIBRALTAR"                                    
#> [218] "STRAIT OF HORMUZ"                                       
#> [219] "STRAIT OF SICILY"                                       
#> [220] "STRAITS OF FLORIDA"                                     
#> [221] "STRANGFORD LOUGH"                                       
#> [222] "STRONSAY FIRTH"                                         
#> [223] "SULU SEA"                                               
#> [224] "SWANSEA BAY"                                            
#> [225] "TAI-WAN STRAIT"                                         
#> [226] "TASMAN SEA"                                             
#> [227] "TATARSKIY PROLIV"                                       
#> [228] "TEES BAY"                                               
#> [229] "TELUK BERAU"                                            
#> [230] "TELUK BONE"                                             
#> [231] "TELUK TOMINI"                                           
#> [232] "THAMES ESTUARY"                                         
#> [233] "THE SOUND"                                              
#> [234] "THE WASH"                                               
#> [235] "TIMOR SEA"                                              
#> [236] "TORRES STRAIT"                                          
#> [237] "TREMADOG BAY"                                           
#> [238] "TRYOSHNIKOVA GULF"                                      
#> [239] "TYRRHENIAN SEA"                                         
#> [240] "WADDEN SEA"                                             
#> [241] "WEDDELL SEA"                                            
#> [242] "WESTERN SCHELDT"                                        
#> [243] "WESTRAY FIRTH"                                          
#> [244] "WEYMOUTH BAY"                                           
#> [245] "WHITE SEA"                                              
#> [246] "WHITEFISH BAY"                                          
#> [247] "WIGTOWN BAY"                                            
#> [248] "YELL SOUND"                                             
#> [249] "YELLOW SEA"

plot(seavox["sub_region"])
#> Warning in st_is_longlat(x): bounding box has potentially an invalid value
#> range for longlat data

Created on 2024-06-07 with reprex v2.1.0

jaseeverett commented 5 months ago

I dug through the GitHub commits and changelogs and I think the natural earth data comes from the "Limits of Oceans and Seas" book. You can view the latest (?) here: https://legacy.iho.int/mtg_docs/com_wg/S-23WG/S-23WG_Misc/Draft_2002/Draft_2002.htm

I am happy with the SeaVox data if you think that is better. It would make more sense if you also want the package to work with estuaries and lakes etc. The user should know the name of their sea/lake/ocean etc so their download won't be long.

Can you setup rappdirs with mregions2? That would help with repeated downloads and allow the user to rerun code offline. I have enabled it with my MPA code