Raster data
Now that we have implemented a data structure for loading and saving vector data, we can proceed to do the same for raster data. As stated earlier, we will be creating three submodules inside our raster
package: data
, loader
, and saver
. To make these accessible from their parent raster package, we need to import it in raster/__init__.py
as follows:
from . import data from . import loader from . import saver
A data interface for raster data
Raster data has a very different structure that we must accommodate, and we begin by making its data interface. The code for this interface will be contained in a module of its own inside the raster folder. To create this module now, save it as raster/data.py
. Start it out with a few basic imports, including the loader and saver modules that we have not yet created and PIL which we installed in Chapter 1, Preparing to Build Your Own GIS Application:
# import builtins import sys, os, itertools, operator # import internals from . import loader...