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.
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
For an extra challenge, you could use Shapely's
centroid()
method to calculate a more accurate representation of each country's center. To do this, you would have to convert the country's outline into a Shapely geometry, calculate the centroid, and then...