Overlaying spatial datasets

Working with Geospatial Data in Python

Joris Van den Bossche

Open source software developer and teacher, GeoPandas maintainer

Intersection with a polygon

countries.intersection(circle)
Working with Geospatial Data in Python

Intersection with a polygon

Limitations of countries.intersection(circle):

  • Only intersecting a GeoSeries with a single polygon
  • Does not preserve attribute information
Working with Geospatial Data in Python

Overlaying two datasets

countries.plot()

geologic_regions.plot()
Working with Geospatial Data in Python

Overlaying two datasets

geopandas.overlay(countries, geologic_regions, 
                  how='intersection')
Working with Geospatial Data in Python

Overlay vs intersection

Intersection method (with single polygon)

countries.intersection(geologic_region_A)
0                            ()
1    POLYGON ((-1.661 48.803...
2    POLYGON ((1.201 51.145,...
dtype: object

Overlay method

geopandas.overlay(countries, geologic_regions,
                  how='intersection')
     name geologic_region              geometry
1  France               C  POLYGON ((2.5 51....
2      UK               C  POLYGON ((0.7 52 ...
3  France               B  POLYGON ((-1.7 46...
..    ...             ...                   ...
Working with Geospatial Data in Python

Let's practice!

Working with Geospatial Data in Python

Preparing Video For Download...