I have a function to create buffers from everything in a shapefile, but I'm getting an error on some files: Record's geometry type does not match collection schema's geometry type: 'Polygon' != 'LineString'
Here's my function:
def buffer_file(src, dst, buffer):
if not os.path.isfile(dst):
with fiona.open(src) as input:
input_meta = copy.deepcopy(input.meta)
input_meta['schema']['properties'] = { 'id': 'int'}
with fiona.open(dst, 'w', **input_meta) as output:
for i, point in enumerate(input):
output.write({
'properties': { 'id': i },
'geometry': mapping(shape(point['geometry']).buffer(buffer))
})
What am I missing to make this work with all files? I works with most files I throw at it flawlessly. I just have some problem files.