Learn R Programming

lawn (version 0.5.0)

lawn_featureof: Enforce expectations about types of Feature inputs

Description

Enforce expectations about types of Feature inputs

Usage

lawn_featureof(x, type, name, lint = FALSE)

Arguments

x

a data-Feature with an expected geometry type. required.

type

(character) expected GeoJSON type. required.

name

(character) name of calling function. required.

lint

(logical) Lint or not. Uses geojsonhint. Takes up increasing time as the object to get linted increases in size, so probably use by default for small objects, but not for large if you know they are good geojson objects. Default: FALSE

Value

nothing if no problems - error message if a problem

See Also

Other invariant: lawn_collectionof, lawn_geosjontype

Examples

Run this code
# NOT RUN {
# all okay
x <- "{ type: 'Feature', properties: {}, geometry: { type: 'Point',
  coordinates: [10, 50] } }"
lawn_featureof(x, 'Point', 'foobar')

# error
# lawn_featureof(x, 'MultiPoint', 'foobar')
# }

Run the code above in your browser using DataLab