I'm using Fiona to write a shapefile containing geometries of US Census congressional districts and census tracts with some computed attributes. Unfortunately, my file is being outputted blank. I am able to see the records in QGIS but not the geometries.
In my code, I take the shapely polygons read in from census shapefiles, compute properties and feed the polygons with the relevant attributes to fiona filewriter.
# schema for the file
myschema = {
'geometry':'Polygon',
'properties':{'is boundary':'int','id':'str', 'district':'int'}
}
with fiona.open(name,'w',crs=from_epsg(4326), driver='ESRI Shapefile', schema=myschema) as output:
...
self.w.write({
'geometry':mapping(sg.asShape(self.subunit)),
'properties':{'is boundary':int(is_boundary), 'id':str(self.sid), 'district':0},
})
self.w is a reference to output after it's passed to an object and self.subunit is a pysal polygon geometry which I convert to shapely in order to write it to my shapefile. Has anyone had problems with this shapefile writing using fiona and know where my problem could be?