Parse Esri JSON
Parses an Esri FeatureSet JSON object into an R object. If there is nogeometry present, a data.frame is returned. If there is geometry, an sf object is returned.
Usage
parse_esri_json(string,..., call=rlang::caller_env())Arguments
- string
the raw Esri JSON string.
- ...
additional arguments passed to
RcppSimdJson::fparse- call
The execution environment of a currently runningfunction, e.g.
call = caller_env(). The corresponding functioncall is retrieved and mentioned in error messages as the sourceof the error.You only need to supply
callwhen throwing a condition from ahelper function which wouldn't be relevant to mention in themessage.Can also be
NULLor adefused function call torespectively not display any call or hard-code a code to display.For more information about error calls, seeIncluding function calls in error messages.
Examples
esri_json<-'{ "geometryType": "esriGeometryPolygon", "spatialReference": { "wkid": 4326 }, "hasZ": false, "hasM": false, "features": [ { "attributes": { "id": 1 }, "geometry": { "rings": [ [ [0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 0.0] ] ] } } ]}'parse_esri_json(esri_json)#> Simple feature collection with 1 feature and 1 field#> Geometry type: MULTIPOLYGON#> Dimension: XY#> Bounding box: xmin: 0 ymin: 0 xmax: 1 ymax: 1#> Geodetic CRS: WGS 84#> id geometry#> 1 1 MULTIPOLYGON (((0 0, 1 0, 1...