ohsome_boundary {ohsome}R Documentation

Create an ohsome_boundary object

Description

Creates an ohsome_boundary object from various classes of input geometries. The ohsome_boundary object is used to set the bpolys, bboxes or bcircles parameter of an ohsome_query object.

Usage

ohsome_boundary(boundary, ...)

## S3 method for class 'ohsome_boundary'
ohsome_boundary(boundary, ...)

## S3 method for class 'character'
ohsome_boundary(boundary, ...)

## S3 method for class 'sf'
ohsome_boundary(boundary, digits = 6, ...)

## S3 method for class 'sfc'
ohsome_boundary(boundary, ...)

## S3 method for class 'sfg'
ohsome_boundary(boundary, ...)

## S3 method for class 'bbox'
ohsome_boundary(boundary, ...)

## S3 method for class 'matrix'
ohsome_boundary(boundary, ...)

## S3 method for class 'list'
ohsome_boundary(boundary, ...)

Arguments

boundary

Bounding geometries specified by WGS84 coordinates in the order ⁠lon,lat⁠. The geometries of sf are transformed to WGS84 if the CRS of the object is known. The following classes are supported:

  • sf with (MULTI)POLYGON geometries

  • sfc with (MULTI)POLYGON geometries

  • sfg with (MULTI)POLYGON geometries and WGS 84 coordinates

  • bbox created with sf::st_bbox() or tmaptools::bb()

  • matrix created with sp::bbox() or osmdata::getbb()

  • character providing textual definitions of bounding polygons, boxes or circles as allowed by the ohsome API (see ohsome API - Boundaries ):

    • bboxes: WGS84 coordinates in the following format: "id1:lon1,lat1,lon2,lat2|id2:lon1,lat1,lon2,lat2|..." OR "lon1,lat1,lon2,lat2|lon1,lat1,lon2,lat2|..."

    • bcircles: WGS84 coordinates + radius in meter in the following format: "id1:lon,lat,r|id2:lon,lat,r|..." OR "lon,lat,r|lon,lat,r|..."

    • bpolys: WGS84 coordinates given as a list of coordinate pairs (as for bboxes) or GeoJSON FeatureCollection. The first point has to be the same as the last point and MultiPolygons are only supported in GeoJSON.

  • list of bbox, matrix or character. Bounding geometry types of all list elements must be the same. Does not work with GeoJSON FeatureCollections.

...

Additional arguments other than digits are ignored.

digits

integer; number of decimal places of coordinates in the resulting GeoJSON when converting sf to GeoJSON (defaults to 6).

Value

An ohsome_boundary object which contains the following elements:

Examples

# Defintion of a bounding circle (lon,lat,radius in meters)
ohsome_boundary("8.6528,49.3683,1000") 

# Definition of two named bounding circles
ohsome_boundary("Circle 1:8.6528,49.3683,1000|Circle 2:8.7294,49.4376,1000")

# Definition of two named bounding circles with a character vector
ohsome_boundary(c("Circle 1:8.6528,49.3683,1000", "Circle 2:8.7294,49.4376,1000"))

# Use franconia from the mapview package as bounding polygons

ohsome_boundary(mapview::franconia, digits = 4)

 
# Use the bounding box of franconia

ohsome_boundary(sf::st_bbox(mapview::franconia))


# Get bounding box of the city of Berlin from OSM
## Not run: 
ohsome_boundary(osmdata::getbb("Berlin"))

## End(Not run)
 
# Use a list of two bounding boxes
## Not run: 
ohsome_boundary(list(osmdata::getbb("Berlin"), sf::st_bbox(mapview::franconia)))

## End(Not run)


[Package ohsome version 0.2.2 Index]