This is companion code to this guide.
Created
October 31, 2012 15:25
-
-
Save tmcw/3987659 to your computer and use it in GitHub Desktop.
GIS with Python, Shapely and Fiona Example 2 - Buffers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from shapely.geometry import mapping, shape | |
from fiona import collection | |
with collection("some.shp", "r") as input: | |
# schema = input.schema.copy() | |
schema = { 'geometry': 'Polygon', 'properties': { 'name': 'str' } } | |
with collection( | |
"some_buffer.shp", "w", "ESRI Shapefile", schema) as output: | |
for point in input: | |
output.write({ | |
'properties': { | |
'name': point['properties']['name'] | |
}, | |
'geometry': mapping(shape(point['geometry']).buffer(5.0)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment