Book Image

Python Geospatial Development Essentials

By : Karim Bahgat
Book Image

Python Geospatial Development Essentials

By: Karim Bahgat

Overview of this book

Table of Contents (15 chapters)
Python Geospatial Development Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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
from...