Geopandas: Spatial Join and maps in Google Colab

Created on 25 Jan 2019  路  4Comments  路  Source: geopandas/geopandas

When performing Spatial Joins in Google Colaboratory, the out of the box installation of geopandas does not work. Youd to install additional dependencies:

  • descartes for plotting
  • rtree and libspatialindex for spatial join.

My notebook can be found here

The issue has to with Google Colab using pip instead of conda so dependencies should be strictly pythonic. You can easily fix the issue by following the steps in this guide:
https://github.com/libspatialindex/libspatialindex/wiki/1.-Getting-Started

Maybe we can add these instructions in the docs. Use with Google Colaboratory or installation using pip vs conda.

Most helpful comment

A simple workaround on rtree installation is to install Gdal and it will take care of it. Here is the notebook with only installing Gdal, geopandas and descartes to work ploting and spatial join.
Geopandas Colab

All 4 comments

We can certainly improve the pip installation instructions in general. For example, as said, more clearly mention that you typically need those optional dependencies as well and how to install them (eg rtree is not that easy).

Pull requests welcome!

A simple workaround on rtree installation is to install Gdal and it will take care of it. Here is the notebook with only installing Gdal, geopandas and descartes to work ploting and spatial join.
Geopandas Colab

I recently did a PR to update the installation docs: https://github.com/geopandas/geopandas/pull/926, which now hopefully make it clearer that, if installing with pip, you need to install additional libraries. But feedback certainly welcome!

A simple workaround on rtree installation is to install Gdal and it will take care of it. Here is the notebook with only installing Gdal, geopandas and descartes to work ploting and spatial join.
Geopandas Colab

Thanks a lot! This worked

Was this page helpful?
0 / 5 - 0 ratings

Related issues

J4nJ4nsen picture J4nJ4nsen  路  3Comments

StevenLi-DS picture StevenLi-DS  路  4Comments

ResidentMario picture ResidentMario  路  6Comments

perrygeo picture perrygeo  路  3Comments

dzanaga picture dzanaga  路  3Comments