ropensci-archive / mregions

MarineRegions R client

Home Page:https://docs.ropensci.org/mregions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty shape file for MRGID 8384

ryanreisinger opened this issue · comments

The shape file for MRGID 8384 "South African Exclusive Economic Zone (Prince Edward Islands)" seems to be empty. A manual download from http://marineregions.org/gazetteer.php?p=details&id=8384 appears fine.

library(mregions)
library(sp)

# Look up names in the EEZ data
rnames <- mr_names("MarineRegions:eez")

# Verify that the entry is among the names
# Prince Edward Islands
# http://marineregions.org/gazetteer.php?p=details&id=8384
rnames[rnames$mrgid == "8384", ]

# Get shape files
pei_eez <- mr_shp(key = "MarineRegions:eez",
                           filter = "8384")

# Plot
plot(pei_eez)

# Contents
str(pei_eez)

@ryanreisinger It seems that filter applies to the geoname property of the features. So this works:

pei_eez <- mr_shp(key = "MarineRegions:eez",
                  filter = "South African Exclusive Economic Zone (Prince Edward Islands)")

Thanks, @pieterprovoost , but the suggestion (as run below) doesn't produce a different/successful result for me. Additionally, I can successfully get other EEZs by filtering on the mrgid (e.g., Kerguelen Islands, mrgid 8387).

library(mregions)
library(sp)

# Get shape files
pei_eez <- mr_shp(key = "MarineRegions:eez",
                  filter = "South African Exclusive Economic Zone (Prince Edward Islands)")

# Plot
plot(pei_eez)

# Contents
str(pei_eez)
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] sp_1.3-2       mregions_0.1.6

loaded via a namespace (and not attached):
[1] compiler_3.6.3  rgdal_1.4-8     tools_3.6.3     rappdirs_0.3.1  grid_3.6.3      lattice_0.20-38

This might be related to the default option of maxFeatures=50 (still default on the CRAN version), this has been fixed in #44

Could you try following:

pei_eez <- mr_shp(key = "MarineRegions:eez",
                  filter = "South African Exclusive Economic Zone (Prince Edward Islands)",
                  maxFeatures = 500)

Okay, I can confirm that, in general, filtering on the mrgid does not seem to work reliably (although it seems to have worked in some cases). Trying your solution:

pei_eez <- mr_shp(key = "MarineRegions:eez",
                  filter = "South African Exclusive Economic Zone (Prince Edward Islands)",
                  maxFeatures = 500)

does work, thanks! I'll install the dev version.

Thanks for the lightning-fast responses!