I have downloaded a shapefile (.shp) that I'd like to read in using fiona.open and delete records. The reason I'd like to delete records is that some records have "None" geometries.
So I want to delete a record if it doesn't have a geometry: {'geometry': None, 'type': 'Feature', 'id': etc etc etc}
Here's my code:
import fiona
with fiona.open('data/ssc_2016_aust_shape/SSC_2016_AUST.shp') as file:
for p in file: # for every record - note that p is a dictionary
if p["geometry"] is None: # if p doesn't have a geometry
del p # then delete the entire record in the shape file
I'd like for the original shapefile (.shp) to be overwritten (this is important).
You can download the shapefile here: http://www.abs.gov.au/AUSSTATS/[email protected]/DetailsPage/1270.0.55.003July%202016?OpenDocument
The file on the ABS website is called "State Suburbs ASGS Ed 2016 Digital Boundaries in ESRI Shapefile Format" in the form of a ZIP file.