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

Understanding how images are represented


In order to understand what images are in terms of computer representation and the data they contain, we are going to start with some examples. The first thing to do is to organize your project to follow this chapter's code as follows:

  1. As before, inside your geopy project, make a copy of your Chapter5 folder and rename it to Chapter6.

  2. Inside Chapter6, navigate to the experiments folder and create a new file inside it named image_experiments.py. Open it for editing.

We will start by inspecting a small sample image that has a structure similar to a large satellite image.

Nothing fancy, you will see four squares of different colors. But if we take a step further and add a grid to it, we can see a little bit more information.

The image was divided into 16 squares of equal size. Each one of these squares is a so-called pixel. A pixel is the smallest portion of information that an image (that is, raster data) contains. While talking about geoprocessing, the...