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

Preface

Python has become the language of choice for many in the geospatial industry. Some use Python as a way to automate their workflows in software, such as ArcGIS or QGIS. Others play around with the nuts and bolts of Python's immense variety of third-party open source geospatial toolkits.

Given all the programming tools available and the people already familiar with geospatial software, there is no reason why you should have to choose either one or the other. Programmers can now develop their own applications from scratch to better suit their needs. Python is, after all, known as a language for rapid development.

By developing your own application, you can have fun with it, experiment with new visual layouts and creative designs, create platforms for specialized workflows, and tailor to the needs of others.

What this book covers

Chapter 1, Preparing to Build Your Own GIS Application, talks about the benefits of developing a custom geospatial application and describes how to set up your development environment, and create your application folder structure.

Chapter 2, Accessing Geodata, implements the crucial data loading and saving capabilities of your application for both vector and raster data.

Chapter 3, Designing the Visual Look of Our Application, creates and puts together the basic building blocks of your application's user interface, giving you a first look at what your application will look like.

Chapter 4, Rendering Our Geodata, adds rendering capabilities so that the user can interactively view, zoom, and pan data inside the application.

Chapter 5, Managing and Organizing Geographic Data, creates a basic functionality for splitting, merging, and cleaning both the vector and raster data.

Chapter 6, Analyzing Geographic Data, develops basic analysis functionality, such as overlay statistics, for vector and raster data.

Chapter 7, Packaging and Distributing Your Application, wraps it all up by showing you how to share and distribute your application, so it is easier for you or others to use it.

Chapter 8, Looking Forward, considers how you may wish to proceed to further build on, customize, and extend your basic application into something more elaborate or specialized in whichever way you want.

What you need for this book

There are no real requirements for this book. However, to keep the book short and sweet, the instructions assume that you have a Windows operating system. If you are on Mac OS X or Linux, you should still be able create and run the application, but then you will have to figure out the equivalent installation instructions for your operating system. You may be forced to deal with compiling C++ code and face the potential of unexpected errors. All other installations will be covered throughout the book, including which Python version to use.

Who this book is for

This book is ideal for Python programmers and software developers who are tasked with or wish to make a customizable special-purpose GIS application, or are interested in expanding their knowledge of working with spatial data cleaning, analysis, or map visualization. Analysts, political scientists, geographers, and GIS specialists seeking a creative platform to experiment with cutting-edge spatial analysis, but are still only beginners in Python, will also find this book beneficial. Familiarity with Tkinter application development in Python is preferable but not mandatory.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Download the Shapely wheel file that fits our system, looking something like Shapely‑1.5.7‑cp27‑none‑win32.whl."

A block of code is set as follows:

class LayerGroup:
    def __init__(self):
        self.layers = list()
        self.connected_maps = list()

    def __iter__(self):
        for layer in self.layers:
            yield layer

    def add_layer(self, layer):
        self.layers.append(layer)

    def move_layer(self, from_pos, to_pos):
        layer = self.layers.pop(from_pos)
        self.layers.insert(to_pos, layer)

    def remove_layer(self, position):
        self.layers.pop(position)

    def get_position(self, layer):
        return self.layers.index(layer)

Any command-line input or output is written as follows:

>>> import PIL, PIL.Image
>>> img = PIL.Image.open("your/path/to/icon.png")
>>> img.save("your/path/to/pythongis/app/icon.ico", sizes=[(255,255),(128,128),(64,64),(48,48),(32,32),(16,16),(8,8)])

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Click on the Inno Setup link on the left side."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.