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 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?

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

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.

  • Yup - but still #2 is elusive.
    – jebyrnes
    Jan 17 '18 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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