Load GeoJSON as sf object

read_geojson_str(str, opts = list(), ..., json_opts = list())

read_geojson_file(filename, opts = list(), ..., json_opts = list())

Arguments

str

Single string containing GeoJSON

opts

Named list of GeoJSON-specific options. Usually created with opts_read_geojson(). Default: empty list() to use the default options.

...

Any extra named options override those in GeoJSON-specific options - opts

json_opts

Named list of vanilla JSON options as used by read_json_str(). This is usually created with opts_read_json(). Default value is an empty list() which means to use all the default JSON parsing options which is usually the correct thing to do when reading GeoJSON.

filename

Filename

Value

sf object

Examples

geojson_file <- system.file("geojson-example.json", package = 'yyjsonr')
read_geojson_file(geojson_file)
#> Simple feature collection with 3 features and 2 fields
#> Geometry type: GEOMETRY
#> Dimension:     XY
#> Bounding box:  xmin: 100 ymin: 0 xmax: 105 ymax: 1
#> Geodetic CRS:  WGS 84
#>    prop0           prop1                       geometry
#> 1 value0            <NA>                POINT (102 0.5)
#> 2 value0        0.000000 LINESTRING (102 0, 103 1, 1...
#> 3 value0 {"this":"that"} POLYGON ((100 0, 101 0, 101...