lawn_geosjontype: Enforce expectations about types of GeoJSON objects.

View source: R/geojsontype.R

lawn_geosjontypeR Documentation

Enforce expectations about types of GeoJSON objects.

Description

Enforce expectations about types of GeoJSON objects.

Usage

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

Arguments

x

value of any data-GeoJSON object. required.

type

expected GeoJSON type. required.

name

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_featureof()

Examples

# all okay
x <- "{ type: 'Point', coordinates: [10, 50] }"
lawn_geosjontype(x, 'Point', 'fooBar')

# error
# lawn_geosjontype(x, 'Polygon', 'fooBar')

ropensci/lawn documentation built on May 18, 2022, 9:58 a.m.