spat_feature: Creates the description of a spatial feature in XML format

spat_featureR Documentation

Creates the description of a spatial feature in XML format

Description

The coordinates have to be specified in the way done in the corresponding sf function:

  • sf::st_point()

  • sf::st_linestring()

  • sf::st_polygon()

  • sf::st_multipoint()

  • sf::st_multilinestring()

  • sf::st_multipolygon(),

  • sf::st_bbox() (for envelope)

Usage

spat_feature(
  sptype,
  crs_in,
  coords,
  version = WFS_get_version(),
  sep = WFS_get_sep()
)

Arguments

sptype

Character string with the type of spatial feature. One of envelope, point, linestring, polygon or the multi version of the last three options. The argument is case insensitive

crs_in

Character string indicating the Coordinate Reference System

coords

A numeric vector of even length with the coordinates of the feature or a list (of lists) of those vectors. Instead of a vector also a two-column matrix can be specified.

version

Character string with the WFS request version

sep

Character string with separator (to be used to split outer from inner polygons). Useful for printouts of query strings.

Details

In places where the corresponding sf function requires a two-column matrix, this function also accepts even-length vectors. See Details.

Assuming that we always use a two_colum matrix (apart from the 'envelope' that needs a length four vector) we need the following coordinates structure:

  • point : a one-row matrix

  • linestring : a n-row matrix with n > 1

  • polygon : a list of matrices where each matrix has more than three rows with the first row equal to the last. The first matrix specifies the outer boundary and the optional other matrices specify holes.

  • multipoint: a n-row matrix with n > 1

  • multilinestring : a list of linestring specifications

  • multipolygon : a list of polygon specifications (therefore a list of a list)

The resulting XML fragment can be used in build_filter() or spat_xml()

Value

Character vector with the created xml fragment

Examples

## Not run: 
crs <- 'EPSG:28992'
spat_feature('envelope',crs, c(x1,y1,x2,y2) )
spat_feature('point',crs, c(x1,y1) )
spat_feature('linestring',crs, matrix(c(x1,y1,x2,y2,x3,y3),ncol=2,byrow=T) ) # or
spat_feature('linestring',crs, c(x1,y1,x2,y2,x3,y3) )
spat_feature('polygon',crs,list(outer_coords,hole1_coords,hole2_coords) )
spat_feature('multipolygon',crs,list(polygon1,polygon2))

## End(Not run)

HanOostdijk/HOQCwfs documentation built on March 6, 2023, 8:18 a.m.