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

Creating the Map Maker app


Now we will prepare an environment that is capable of using this data source. We are going to adapt the previous experiments into building blocks for the application and put them inside an application class, just as we did with the Geocaching app.

First let's organize the folder and files.

  1. Create a new package called map_maker inside your Chapter5 folder. To do this, right-click on the folder and chose New | Python Package.

  2. Move the my_datasource.py file to the map_make folder (drag and drop it).

  3. Copy the map_style.xml and map_functions.py files that are inside the mapnik_experiments folder to the map_maker folder.

  4. Rename map_style.xml to styles.xml.

  5. In the Chapter5 root, create a file named map_maker_app.py. The complete tree structure should look like this:

    Chapter5
    │   geocaching_app.py
    |   map_maker_app.py
    │   models.py
    │
    ├───mapnik_experiments
    │
    ├───map_maker
    │       __init__.py
    │      my_datasource.py
    |       styles.xml
    |       map_functions.py
    │
    ├───utils

    Now we...