Spatial operations: creating new geometries

Working with Geospatial Data in Python

Joris Van den Bossche

Open source software developer and teacher, GeoPandas maintainer

Spatial operations

Working with Geospatial Data in Python

Spatial operations: intersection

Working with Geospatial Data in Python

Spatial operations: union

Working with Geospatial Data in Python

Spatial operations: difference

Working with Geospatial Data in Python

Spatial operations with GeoPandas

africa.head()
           name             geometry
0        Angola  (POLYGON ((23.90...
1       Burundi  POLYGON ((29.339...
2         Benin  POLYGON ((2.6917...
3  Burkina Faso  POLYGON ((2.1544...
4      Botswana  POLYGON ((29.432...

Working with Geospatial Data in Python

Spatial operations with GeoPandas

print(box)
POLYGON ((60 10, 60 -10, -20 -10, -20 10))

Working with Geospatial Data in Python

Spatial operations with GeoPandas

africa.intersection(box)

Working with Geospatial Data in Python

Spatial operations with GeoPandas

africa.head()
           name                                           geometry
0        Angola  (POLYGON ((23.90415368011818 -11.7222815894063...
1       Burundi  POLYGON ((29.33999759290035 -4.499983412294092...
2      Botswana  POLYGON ((29.43218834810904 -22.09131275806759...
...
africa.intersection(box)
0    (POLYGON ((13.22332255001795 -10, 13.120987583...
1    POLYGON ((29.33999759290035 -4.499983412294092...
2                                                   ()
...
dtype: object
Working with Geospatial Data in Python

Let's practice!

Working with Geospatial Data in Python

Preparing Video For Download...