r-spatial / sf

Simple Features for R
https://r-spatial.github.io/sf/
Other
1.34k stars 297 forks source link

Poly2nb #1132

Closed Syeda123-Fatima closed 4 years ago

Syeda123-Fatima commented 5 years ago

nb <- poly2nb(Australia_POP16.shp, row.names = 'POA_CODE16', queen = FALSE) Error in poly2nb(Australia_POP16.shp, row.names = "POA_CODE16", queen = FALSE) : Empty geometries found

How to get rid of empty geometries

edzer commented 5 years ago

Guessing that Australia_POP16.shp is an sf object, try e.g.

Australia_POP16.shp[!st_is_empty(Australia_POP16.shp),]
rsbivand commented 5 years ago

This feels like the (very) legacy practice of the Australian Bureau of Statistics to stuff non-localised data into empty-geometry features referred to in http://maptools.r-forge.r-project.org/reference/readShapeSpatial.html as arguments: delete_null_obj and retrieve_ABS_null. It should be very obvious that any analyses using the neighbour object must also delete the empty geometry features.