Book Image

Geospatial Development By Example with Python

By : Pablo Carreira
5 (1)
Book Image

Geospatial Development By Example with Python

5 (1)
By: Pablo Carreira

Overview of this book

From Python programming good practices to the advanced use of analysis packages, this book teaches you how to write applications that will perform complex geoprocessing tasks that can be replicated and reused. Much more than simple scripts, you will write functions to import data, create Python classes that represent your features, and learn how to combine and filter them. With pluggable mechanisms, you will learn how to visualize data and the results of analysis in beautiful maps that can be batch-generated and embedded into documents or web pages. Finally, you will learn how to consume and process an enormous amount of data very efficiently by using advanced tools and modern computers’ parallel processing capabilities.
Table of Contents (17 chapters)
Geospatial Development By Example with Python
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Building the basic application structure


There are two main reasons to define a good basic structure for our application:

  • It keeps our code organized

  • It allows us to reuse pieces of code in later applications

Python is a flexible language in terms of code organization, and although users are allowed to write the whole application in a single file, it's preferable to separate the functionalities into modules and packages.

Modules are Python files that contain classes and functions that can be imported into another file with the import statement. Packages are special directories (folders) that contain modules. This leads to organized and well-structured code that is less prone to having bugs and is easier to maintain.

The proposed structure is to have a folder for each chapter. Inside it, we can create packages or files for each application; we will create a package for a common utility code that can be imported and reused and a directory to perform experiments.

Creating the application tree structure...