0

I'm using geopandas in a Jupyter notebook, working on OSX. I have imported a couple of shapefiles and transformed their CRSs, without any problems. The shapefiles aren't huge - one of the raw .shp files is 30MB, the other is less than 1MB.

I want to use geopandas to calculate the area of the overlap between them, but when I use overlay to start doing this:

df_sussex = gpd.overlay(df_sussex, df_sac, how='intersection')

the Jupyter notebook just hangs. It's been running for over an hour. There are no errors in the console, and the Activity monitor shows it's taking up 98% of CPU. I'm working on a machine with 16GB of RAM - surely it shouldn't take this long? In PostGIS on the same machine it just takes a few seconds.

Is there any way I can debug what's going on?

Both of the dataframes are in EPSG:4326, so I wonder if it could possibly be related to this geopandas issue.

3
  • After some time, the notebook shows a warning: site-packages/geopandas/base.py:75: UserWarning: Cannot generate spatial index: Missing package rtree. Perhaps this is connected?
    – Richard
    Jan 24, 2018 at 10:51
  • It is 100% connected. An intersection is an expensive task, and without a spatial index it is going to be a very slow.
    – Liam G
    Jan 24, 2018 at 23:08
  • Thanks. Even with an index though, it's still incredibly slow.
    – Richard
    Feb 6, 2018 at 18:54

1 Answer 1

-1

i take an intersection between a 7000 polygons shapefile and a point using geopandas.overlay,it takes 2.3 second, then i do this in the mongodb ,create the geometry index, the intersection opration only takes 0.01 second.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.