Last active
April 16, 2022 09:16
-
-
Save robbibt/7639935045a1473c3af5a86ece4273f1 to your computer and use it in GitHub Desktop.
Appending GeoPandas data to file
This file contains hidden or 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
| # Author: Claire Krause | |
| # Save the polygons to a shapefile | |
| schema = {'geometry': 'Polygon','properties': {'area': 'str'}} | |
| if os.path.isfile('test.shp'): | |
| with fiona.open('test.shp', "a", crs = from_epsg(3577), driver = 'ESRI Shapefile', schema = schema) as output: | |
| for ix, poly in MergedPolygonsGPD.iterrows(): | |
| output.write(({'properties': {'area': poly['area']},'geometry': mapping(shape(poly['geometry']))})) | |
| else: | |
| with fiona.open('test.shp', "w", crs = from_epsg(3577), driver = 'ESRI Shapefile', schema = schema) as output: | |
| for ix, poly in MergedPolygonsGPD.iterrows(): | |
| output.write(({'properties': {'area': poly['area']},'geometry': mapping(shape(poly['geometry']))})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment