Giter VIP home page Giter VIP logo

mregions's Introduction

mregions's People

Contributors

brooklynbagel avatar fmichonneau avatar jeroen avatar karthik avatar lennertschepers avatar lottepohl avatar mdsumner avatar pieterprovoost avatar salvafern avatar sckott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mregions's Issues

Get feature based on the marine regions id

Hi @sckott,

I've recently been working on getting the distribution from WoRMS (worrms::wm_distribution) which returns a marineregions id from which you can call the getGazetteerWMSes.json end point e.g. http://www.marineregions.org/rest/getGazetteerWMSes.json/1906/
Based on this WMS I've then managed to get geojson from the WFS. I still have some bugs but would like to integrate this in mregions. Code dump: https://github.com/iobis/mregions/blob/master/R/mr_gazetteer.R

Some questions:

  • Any thoughts on this?
  • Can I use the sf package instead of sp? Or would you prefer for me to change everything to sp
  • Should I use crul instead of httr?
  • Shall I also try to add the other gazetteer REST services? http://marineregions.org/gazetteer.php?p=webservices

Samuel

use crul instead of httr?

Consider using crul instead of httr, see question in #42
Is crul still preferred over httr or any other package that is recommended?

handle pagination automatically?

I hate having to manually handle pagination with API wrappers, particularly when it's not obvious how many total records are available. Can we get an option to do this automatically (like in gh package with limit=Inf), pretty please? (e.g. for the mr_records_by_type fn, not sure if applies elsewhere).

Improve documentation

The documentation of the package could be a bit improved:

  • add some general intro about MarineRegions.org
  • improve the vignette highlighting some of the key products of MarineRegions (EEZs,...) - remove "Morocco:dam" example
  • add a CONTRIBUTING.md (some examples)
  • add roadmap, as an issue or add new milestone

mr_geo_code does not encode string for GET request

I think that the mr_geo_code() function does not parse the url correctly when using special characters (e.g. spaces,..).

mr_geo_code('Belgian') # works
mr_geo_code('Belgian Exclusive') # Error in mr_geo_code("Belgian Exclusive") : Bad Request (HTTP 400).
mr_geo_code(URLencode('Belgian Exclusive')) # works

I didn't check (yet) if this is also the case for other functions

Empty shape file for MRGID 8384

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)

API OBIS not working: Could not resolve host: api.iobis.org

Hi @pieterprovoost,

Just ran one of the examples of the documentation and this doesn't work

library(mregions)
mr_obis_eez_id("bulgarian exclusive economic zone")
#> Error in curl::curl_fetch_memory(url, handle = handle): Could not resolve host: api.iobis.org

Created on 2022-03-03 by the reprex package (v2.0.0)

I tested both on windows and ubuntu, using the latest version of curl. Can you confirm if this is a problem of the OBIS API?

Thanks!

Add top level namespaces to list of regions

those on the page at http://marineregions.org/downloads.php

  • Continental margins between 140m and 3500m depth (IFREMER - COMARGE, 2009)
  • ETOPO1 Global Relief Model
  • Exclusive Economic Zones Boundaries (EEZ)
  • FAO Fishing Areas
  • GEBCO Gazetteer of undersea feature names
  • General Bathymetric Chart of the Oceans (GEBCO)
  • Global contourite distribution Shapefile
  • ICES Ecoregions
  • ICES Statistical areas
  • ICES Statistical rectangles
  • IHO Sea Areas
  • Large Marine Ecosystems of the World
  • Longhurst Biogeographical Provinces
  • Marine and land zones: the union of world country boundaries and EEZ's
  • Marine Ecoregions of the World, MEOW (Spalding et al., 2007)
  • Marineregions: intersect of EEZ's and IHO areas
  • OSPAR Boundaries and Regions
  • Statistics on Marbound and IHO (Costello et al., 2011)
  • TDWG Geography shapefiles
  • Terrestrial Ecoregional Boundaries Shapefile (TNC)
  • The NAFO Convention Area
  • The SeaVoX Salt and Fresh Water Body Gazetteer
  • World Marine Heritage Sites

WFS 2.0.0 returns JSON coordinates as [y, x]

mr_features_get uses WFS 2.0.0 which will, despite the GeoJSON spec, return coordinates as [y, x]:

Perhaps add an option to use WFS 1.0.0?

Code example:

require(mregions)
require(wellknown)
require(jsonlite)

n <- mr_names("MarineRegions:eez")
id <- mr_names_search(n, "Belgian")$id[1]
jsonstr <- mr_features_get("MarineRegions:eez", id, format = "json")
json <- fromJSON(jsonstr, simplifyVector = FALSE, simplifyDataFrame = FALSE)
wkt <- geojson2wkt(json$features[[1]]$geometry)

WFS calls:

transfer to ropensci

since we keep onboarded repos there ๐Ÿ˜บ

If you transfer it, could you please add an active status badge to the README when updating all links? ๐Ÿ™

[![Project Status: Active โ€“ The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)

Deprecated as_data_frame(), use as_tibble() in mr_names

We shall consider to switch to as_tibble()

library(mregions)
rnames <- mr_names("MarineRegions:iho")
#> Warning: `as_data_frame()` was deprecated in tibble 2.0.0.
#> Please use `as_tibble()` instead.
#> The signature and semantics have changed, see `?as_tibble`.

Created on 2022-03-03 by the reprex package (v2.0.0)

Can't get place relations

When I tried to get place relations by mr_place_relations(), I found out that type = c("partof", "partlypartof", "adjacentto", "similarto", "administrativepartof", "influencedby", "all") didn't work.
I get exactly the same results by mr_place_relations(307, type = "adjacentto") and mr_place_relations(307)
even if the default value for type should be "partof".

Changing maxFeatures argument in mr_shp?

Hi Scott, I've been playing with the new CRAN version, very impressed but have one issue regarding the maxFeatures argument in mr_shp - I would like to download (for example) a shape file of all 100 or so IHO Sea Areas, but the import is limited to 50:

res4 <- mr_shp(key = "MarineRegions:iho")
length(res4$name)

gives 50. It looks like I should be able to change this by changing the maxFeatures argument but this doesn't seem to work - I still get 50 regions returned whether I set this argument to 10 or 100, e.g.

res4 <- mr_shp(key = "MarineRegions:iho", maxFeatures = 10))
length(res4$name)

also gives 50. Am I missing something obvious here? Would be really useful to be able to get the full set of shapes for a given geometry to allow e.g. summarising a species distribution, as records per IHO area, EEZ, or whatever.

Thanks!

empty spatial polygon dataframe

The following is occurring with mregions and leaflet:

Warning messages:
1: In polygonData.SpatialPolygonsDataFrame(data) :
Empty SpatialPolygonsDataFrame object passed and will be skipped
2: In polygonData.SpatialPolygonsDataFrame(data) :
Empty SpatialPolygonsDataFrame object passed and will be skipped

It then fails to plot two polygons Kiribati and Fiji but plots other polygons without trouble. Have tried it with base-R plot function and ggplot. The same error occurs.

R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252

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

other attached packages:
[1] maps_3.2.0 plotrix_3.7 Grid2Polygons_0.2.1 spdep_0.7-4 spData_0.2.7.4 Matrix_1.2-12 gridExtra_2.3
[8] data.table_1.10.4-3 forcats_0.2.0 stringr_1.2.0 dplyr_0.7.4 purrr_0.2.4 readr_1.1.1 tidyr_0.7.2
[15] tibble_1.4.1 tidyverse_1.2.1 ggplot2_2.2.1 igraph_1.1.2 raster_2.6-7 rgeos_0.3-26 rgdal_1.2-16
[22] leaflet_1.1.0 mregions_0.1.6 BESTMPA_0.1.0 sp_1.2-7 RPostgreSQL_0.6-2 DBI_0.7

loaded via a namespace (and not attached):
[1] httr_1.3.1 jsonlite_1.5 splines_3.4.3 gtools_3.5.0 modelr_0.1.1 shiny_1.0.5 assertthat_0.2.0 expm_0.999-2 cellranger_1.1.0
[10] yaml_2.1.16 LearnBayes_2.15 pillar_1.1.0 lattice_0.20-35 glue_1.2.0 digest_0.6.14 rvest_0.3.2 colorspace_1.3-2 htmltools_0.3.6
[19] httpuv_1.3.5 plyr_1.8.4 psych_1.7.8 pkgconfig_2.0.1 broom_0.4.3 haven_1.1.1 gmodels_2.16.2 xtable_1.8-2 scales_0.5.0
[28] gdata_2.18.0 lazyeval_0.2.1 cli_1.0.0 mnormt_1.5-5 magrittr_1.5 crayon_1.3.4 readxl_1.0.0 mime_0.5 deldir_0.1-14
[37] nlme_3.1-131 MASS_7.3-47 xml2_1.1.1 foreign_0.8-69 tools_3.4.3 hms_0.4.0 munsell_0.4.3 bindrcpp_0.2 compiler_3.4.3
[46] rlang_0.1.6 rstudioapi_0.7 rappdirs_0.3.1 htmlwidgets_1.0 crosstalk_1.0.0 tcltk_3.4.3 boot_1.3-20 gtable_0.2.0 curl_3.1
[55] reshape2_1.4.3 R6_2.2.2 lubridate_1.7.1 bindr_0.1 stringi_1.1.6 parallel_3.4.3 Rcpp_0.12.15 coda_0.19-1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.