Skip to content
Advertisement

Is overlay how=’difference’ supposed to operate differently from geopandas 0.9 vs 0.10?

I was using the difference set operation for a different problem, but I would get an empty geodataframe or None type when replacing a polygon with the difference in my geodataframe. I found it to be a result of having non-intersecting polygons and doing the difference set-operation. I was wondering is this normal behavior or should it still be keeping the geometry for df1? This behavior is different between version 0.10 and version 0.9.

For example:

JavaScript

Displaying two non intersecting polygons

displaying two non intersecting polygons

As you can see these polygons are not intersecting. So when I do the difference set operation,

JavaScript

the output is then this,

Empty geodataframe empty geodataframe

where I would expect to see df1 geometry show up in the res_difference variable. Is this how difference is supposed to work?

The reason I would expect df1 geometry to show up in res_difference is based on the behavior in geopandas 0.9. When I run the following code using geopandas 0.9 instead of geopandas 0.10

JavaScript

You get this output

plotting res_difference in geopandas 0.9

This is the behavior I would expect to see in geopandas 0.10 but if the polygons don’t intersect then you get an empty geodataframe. Is this supposed to happen or is this a result of implementing the spatial indexing?

Advertisement

Answer

This is a regression in a 0.10 release. Sorry about that! We’ll try to get it fixed soon. In the meantime, I would suggest sticking to 0.9.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement