Geographic Information Systems Asked by JakeGIS on March 9, 2021
I am trying to buffer points which are quite close together, and then dissolve the overlapping buffer polygons into larger polygons. After doing the buffer is where I have the issue. I have tried using dissolve(‘geometry’) but that gives this error.
KeyError: 'geometry'
I think the proper way to do this is using unary_union but my output is a multipolygon and I cant use it.
gdf2 = gpd.read_file(SELECT)
gdf2b = gdf2.buffer(gridDist)
gdfu = gdf2b.unary_union
gdfu.plot()
AttributeError: 'MultiPolygon' object has no attribute 'plot'
Or if I try to send the unary_union to a file
gpd.GeoSeries.to_file(gdf3u, BUFF1, driver="ESRI Shapefile")
AttributeError: 'MultiPolygon' object has no attribute 'index'
So my question is how can I either dissolve these polygons based on their self intersecting geometry and have the result be a geodataframe or a geoseries?
Or how can I transform the multipolygon I have from into a geodataframe?
Put the geometry into a new GeoDataFrame, that's what has the .plot()
method.
new = gpd.GeoDataFrame(crs=gdf2.crs, geometry=[gdfu])
new.plot()
then you can write out the new
object
new.to_file('path/to/file')
Correct answer by rickD on March 9, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP