Union polygons without merging
To demonstrate what merging is all about, we will take an example from the National Oceanic and Atmospheric Administration (NOAA) weather data. It provides an awesome minute-by-minute update of Shapefiles for your desire to download data. We will look at a one-week collection of weather warnings, and combine these with state boundaries to see where exactly warnings occurred within a state boundary.
The preceding screenshot shows us the polygons before the union operation in QGIS.
Getting ready
Make sure your virtual environment is, as always, fired up and run the following command:
$ source venvs/pygeo_analysis_cookbook/bin/activate
Next, switch to your /ch06/code/
folder to find finished code examples or create your empty file in the /ch06/
working folder and follow along with the code.
How to do it...
The pyshp
and shapely
libraries are our two workhorses for this exercise:
You can simply run this file in the command prompt to see the results as follows:
>>...