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.

  • 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 '18 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 '18 at 23:08
  • Thanks. Even with an index though, it's still incredibly slow. – Richard Feb 6 '18 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.