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

Combining functions into an application


So far, we looked at very useful utility functions that perform specific tasks; however, to form an application, we need to combine these functions by calling them in an ordered manner to achieve our objectives. We need code that orchestrates the calls and results—one that will make the application run.

For this, we will dive into one of the most beautiful and powerful parts of Python programming: classes and methods.

Python is an object-oriented programming language (but it is not strict). If you are not familiar with the concept of object-oriented programming, don't worry; the best way to understand what this is about is by examples, so I won't go into theories now but teach by example instead. Perform the following steps now:

  1. Remember the application's entry point? It's in the Chapter2 folder, in the geochaching_app.py file. Open it for editing, and you should have this:

    # coding=utf-8    
    
    def main():print "Hello geocaching APP!"
        
    
    if __name__...