The raster version of the least cost path route is useful for visualization, but it isn't much good for analysis because it is embedded in the raster, and it is, therefore, difficult to relate to other datasets as we have done so many other times in this book. Our next goal will be to use the path data that we saved when creating the route to create a shapefile since the saved data is in the proper order. The following code will convert our raster path to a shapefile that is easier to use in a GIS for analysis:
- First, we'll import the modules that we need, which aren't many. We'll use the pickle module to restore the path data object. Then, we'll use the linecache module to read the geospatial header information from the path raster in order to map the path rows and columns to the earth coordinates. Finally, we&apos...