6

I'm working on a project where I'm looking at overlap in users circling an area in an image. Esentially, I make a SpatialPolygonsDataFrame where each user gets one row. Some users don't select anything. So, I'm trying to figure out how to include that information. When I attempt to create a "NULL" polygon, and then scale it up, either with something like

Polygon(matrix(rep(NA, 4), nrow=2)

or

Polygon(NULL)

or anysuch, none of these work.

1) Can I create an empty polygon? 2) or add a row to a SpatialPolygonsDataFrame with no matching SpatialPolygons object?

2
  • 1
    FYI, you can create an empty Spatial Polygons object - SpatialPolygons(list())
    – jebyrnes
    Jan 17, 2017 at 23:14
  • 1
    And SpatialPolygonsDataFrame(SpatialPolygons(list()), data=data.frame())
    – jebyrnes
    Jan 17, 2018 at 14:31

1 Answer 1

3

To create an empty SpatialPolygons object use SpatialPolygons(list())

credit to jebyrnes, but I thought it should be posted as an answer not a comment.

1
  • Yup - but still #2 is elusive.
    – jebyrnes
    Jan 17, 2018 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.