Exercises

If you are interested in exploring the techniques used in this chapter further, you might like to challenge yourself with the following tasks:

  • Change the bounding box calculation to exclude outlying islands.

    Tip

    Hint

    You can split each country's MultiPolygon into individual Polygon objects and then check the area of each polygon to exclude those that are smaller than a given total value.

  • Use the World Borders Dataset to create a new shapefile, where each country is represented by a single Point geometry containing the geographical center of each country.

    Tip

    Hint

    You can start with the country bounding boxes we calculated earlier and then calculate the midpoint using this:

    midLat = (minLat + maxLat) / 2
    midLong = (minLong + maxLong) / 2

Get Python Geospatial Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.