I have two SEDFs. df_w has 3 polygons. df_h has 2 polygons both within one of the df_w polygons. Ultimately I need to cut holes in df_w with the df_h polygon. The subject method is throwing an error. I’m missing something about the functionality of the GeoAccessor overlay although it seems straightforward. Anyway, any insight into the issue would be appreciated. Thank you. Tyler
Polygons Visualized:
Method and Error:
Here are the polygons for testing. Thx. Tyler
df_w
,OID,SHAPE_PG
241,242,"{'spatialReference': {'wkid': None}, 'rings': [[[15291.5, 6192.937499999999], [15332.5, 6192.9375], [15332.5, 6341.9375], [15291.5, 6341.9375], [15291.5, 6192.937499999999]]]}"
242,243,"{'spatialReference': {'wkid': None}, 'rings': [[[15037.5, 6301.321927246139], [15037.499999999998, 6192.937499999999], [15285.5, 6192.937499999999], [15285.5, 6347.9375], [15332.5, 6347.9375], [15332.499999999998, 6591.937499999997], [14864.5, 6591.937499999999], [14864.5, 6192.937499999999], [14914.781651165493, 6192.937499999999], [14914.781651165496, 6301.321927246138], [15037.5, 6301.321927246139]]]}"
243,244,"{'spatialReference': {'wkid': None}, 'rings': [[[14994.781651165495, 6293.321927246138], [14922.781651165495, 6293.321927246138], [14922.781651165495, 6200.9375], [14951.5, 6200.937499999999], [14951.5, 6186.937499999999], [14987.5, 6186.937499999999], [14987.5, 6200.9375], [15029.5, 6200.9375], [15029.5, 6293.321927246138], [14994.781651165495, 6293.321927246138]]]}"
df_h
,OID,SHAPE_PG
245,246,"{'spatialReference': {'wkid': None}, 'rings': [[[14903.25, 6381.9375], [14969.25, 6381.9375], [14969.25, 6453.9375], [14903.25, 6453.9375], [14903.25, 6381.9375]]]}"
246,247,"{'spatialReference': {'wkid': None}, 'rings': [[[15119.264718869708, 6351.838419508824], [15168.764718869708, 6351.838419508824], [15168.764718869708, 6405.838419508824], [15119.264718869708, 6405.838419508824], [15119.264718869708, 6351.838419508824]]]}"
Just wanted to leave the solution that worked for me to help future visitors.
Using .reset_index() method on the spatial dataframes before executing spatial.overlay() eliminated this error.
This seems to occur when taking a slice of a dataframe and using that slice in spatial.overlay().