tests/testthat/test-drop_null_geometries.R

test_that("drop_null_geometries_works", {
poly_geojson <-   structure(
  '{"type":"FeatureCollection",
    "features":[{
    "type":"Feature",
    "geometry":{"type":"Point","coordinates":[1,1]},
    "properties":{"x":1}},{
    "type":"Feature",
    "geometry":{},
    "properties":{"x":2}}]}',
  class = c("geojson", "json")
)
expect_snapshot_value(drop_null_geometries(poly_geojson), style = "json2")
})

Try the rmapshaper package in your browser

Any scripts or data that you put into this service are public.

rmapshaper documentation built on April 11, 2023, 5:55 p.m.