I have the following code which get the difference of a pie wedges.
c= gp.overlay(a,b,how='symmetric_difference')
How to get the upper polygon?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityYou just access the c.geometry
attribute.
from shapely.geometry import Polygon
import geopandas as gp
poly1 = gp.GeoSeries([Polygon([(0, 3), (3, 3), (1.5, 0), (0, 3)])])
poly2 = gp.GeoSeries([Polygon([(1, 1), (2, 1), (1.5, 0), (1, 1)])])
a = gp.GeoDataFrame({'geometry': poly1, 'a': [1]})
b = gp.GeoDataFrame({'geometry': poly2, 'b': [2]})
c = gp.overlay(a, b, how='symmetric_difference')
print(c.geometry)
0 POLYGON ((0 3, 3 3, 2 1, 1 1, 0 3))
Name: geometry, dtype: object
Poly 1
Poly 2
Symmetric difference