mr_features_get: Get features

View source: R/mr_features_get.R

mr_features_getR Documentation

Get features

Description

Get features

Usage

mr_features_get(
  type,
  featureID,
  maxFeatures = 100,
  format = "json",
  path = NULL,
  version = "2.0.0",
  ...
)

Arguments

type

(character) a region type, e.g., "MarineRegions:eez". required

featureID

(character) a feature ID. required

maxFeatures

(integer) Number of features. Default: 100

format

(character) output format, see Details for allowed options. Default: json

path

(character) required when format="SHAPE-ZIP", otherwise, ignored

version

(character) either 1.0.0 or 2.0.0 (default). In v1.0.0, the coordinates are in format y,x (long,lat), while in 2.0.0 the coordinates are in format x,y (lat,long)

...

Curl options passed on to httr::GET()

Details

Allowed options for the format parameter:

  • ⁠text/xml; subtype=gml/3.2⁠

  • GML2

  • KML

  • SHAPE-ZIP

  • ⁠application/gml+xml; version=3.2⁠

  • application/json

  • ⁠application/vnd.google-earth.kml xml⁠

  • application/vnd.google-earth.kml+xml

  • csv

  • gml3

  • gml32

  • json

  • ⁠text/xml; subtype=gml/2.1.2⁠

  • ⁠text/xml; subtype=gml/3.1.1⁠

Value

depends on the format option used, usually a text string

Examples

## Not run: 
# json by default
mr_features_get(type = "MarineRegions:eez", featureID = "eez.3")
# csv
mr_features_get(type = "MarineRegions:eez", featureID = "eez.3",
  format = "csv")
# KML
mr_features_get(type = "MarineRegions:eez", featureID = "eez.3",
  format = "KML")

# if you want SHAPE-ZIP, give a file path
# FIXME - shape files not working right now
# file <- tempfile(fileext = ".zip")
# mr_features_get(type = "MarineRegions:eez", featureID = "eez.3",
#   format = "SHAPE-ZIP", path = file)
# file.exists(file)
# unlink(file)

# glm32
mr_features_get(type = "MarineRegions:eez", featureID = "eez.3",
  format = "gml32")

# version parameter
## notice the reversed coordinates
mr_features_get(type = "MarineRegions:eez", featureID = "eez.3")
mr_features_get(type = "MarineRegions:eez", featureID = "eez.3",
  version = "1.0.0")

## End(Not run)

ropensci/mregions documentation built on Feb. 28, 2024, 9:23 a.m.