Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
Python Geospatial Development Essentials
Python Geospatial Development Essentials

Python Geospatial Development Essentials: Utilize Python with open source libraries to build a lightweight, portable, and customizable GIS desktop application

eBook
$9.99 $25.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Python Geospatial Development Essentials

Chapter 2. Accessing Geodata

All GIS processing must start with geographic data, so we begin our application by building the capacity to interact with, load, and save various geographic file formats. This chapter is divided into a vector and raster section, and in each section, we will cover the following:

  • Firstly, we create a data interface which means understanding data structures and how to interact with them.
  • Secondly and thirdly, any format-specific differences are outsourced to separate loader and saver modules.

This is a lot of functionality to fit into one chapter, but by working your way through, you will learn a lot about data structures, and file formats, and end up with a solid foundation for your application.

The approach

In our efforts to build data access in this chapter, we focus on simplicity, understanding, and lightweight libraries. We create standardized data interfaces for vector and raster data so that we can use the same methods and expect the same results on any data, without worrying about file format differences. They are not necessarily optimized for speed or memory efficiency as they load entire files into memory at once.

In our choice of third-party libraries for loading and saving, we focus on format-specific ones, so that we can pick and choose which formats to support and thus maintain a lightweight application. This requires some more work but allows us to learn intricate details about file formats.

Note

If the size is not an issue in your application, you may wish to instead use the more powerful GDAL library, which can single-handedly load and save a much wider range of both vector and raster formats. To use GDAL, I suggest downloading and installing a precompiled version...

Vector data

We begin by adding support for vector data. We will be creating three submodules inside our vector package: data, loader, and saver. To make these accessible from their parent vector package, we need to import it in vector/__init__.py as follows:

from . import data
from . import loader
from . import saver

A data interface for vector data

The first thing we want is a data interface that we can conveniently interact with. This data interface will be contained in a module of its own, so create this module now and save it as vector/data.py.

We start off with a few basic imports, including compatibility functions for Shapely (which we installed in Chapter 1, Preparing to Build Your Own GIS Application) and the spatial indexing abilities of Rtree, a package we will install later. Note that vector data loading and saving, are handled by separate modules that we have not yet created, but since they are accessed through our data interface, we need to import them here:

# import builtins
import...

Raster data

Now that we have implemented a data structure for loading and saving vector data, we can proceed to do the same for raster data. As stated earlier, we will be creating three submodules inside our raster package: data, loader, and saver. To make these accessible from their parent raster package, we need to import it in raster/__init__.py as follows:

from . import data
from . import loader
from . import saver

A data interface for raster data

Raster data has a very different structure that we must accommodate, and we begin by making its data interface. The code for this interface will be contained in a module of its own inside the raster folder. To create this module now, save it as raster/data.py. Start it out with a few basic imports, including the loader and saver modules that we have not yet created and PIL which we installed in Chapter 1, Preparing to Build Your Own GIS Application:

# import builtins
import sys, os, itertools, operator

# import internals
from . import loader...

Summary

In this chapter, we built the core foundation of our application. In each of our vector and raster folders, we created three new modules that allow us to access, edit, and share some popular geographic data formats. Our folder structure should, therefore, look something like this:

Summary

This is the minimum we will need for any type of GIS application. We can theoretically, at this point, make a minimalistic application focused only on loading and handling file formats. In the next chapter, we jump straight into making the visual interface application, so we can have a real interactive application up and running as soon as possible.

Left arrow icon Right arrow icon

Description

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

Who is this book for?

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

What you will learn

  • Design and structure a basic GIS application based on existing tools
  • Customize Tkinter application widgets to make your very own toolkit of flexible and reusable GIS widgets
  • Load, manipulate, and save spatial data, both vector and raster
  • Create an interactive and zoomable window for visualizing spatial data
  • Manage and organize spatial data
  • Create the beginnings of a comprehensive Python library for many types of geospatial tasks, and use this API as the engine behind your application
  • Package your final application into a lightweight and portable executable application

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 17, 2015
Length: 192 pages
Edition : 1st
Language : English
ISBN-13 : 9781782174417
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jun 17, 2015
Length: 192 pages
Edition : 1st
Language : English
ISBN-13 : 9781782174417
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 126.97
Python GeoSpatial Analysis Essentials
$38.99
Python Geospatial Development Essentials
$32.99
Geospatial Development By Example with Python
$54.99
Total $ 126.97 Stars icon
Banner background image

Table of Contents

9 Chapters
1. Preparing to Build Your Own GIS Application Chevron down icon Chevron up icon
2. Accessing Geodata Chevron down icon Chevron up icon
3. Designing the Visual Look of Our Application Chevron down icon Chevron up icon
4. Rendering Our Geodata Chevron down icon Chevron up icon
5. Managing and Organizing Geographic Data Chevron down icon Chevron up icon
6. Analyzing Geographic Data Chevron down icon Chevron up icon
7. Packaging and Distributing Your Application Chevron down icon Chevron up icon
8. Looking Forward Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5
(2 Ratings)
5 star 50%
4 star 50%
3 star 0%
2 star 0%
1 star 0%
Matthew Ryan Jul 23, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A foundation in Python and some exposure to GIS is required to get the most out of this book. This book is pitched at one who is looking to build on those foundations.It sets out nicely the use cases to build your own GIS application and as well presents what existing tools/libraries there are to leverage off.The book hit the spot for me. I'm now, as an exercise for myself, leveraging what I've learnt from the book to port the user interface over to PySide. Loving it.
Amazon Verified review Amazon
Chris Jul 23, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Python Geospatial Development is a good guide for programmers looking for help while throwing together a project or to generally enhance and practice their GIS application building skills. It is is a good book for a python programmer with some application building experience who is is generally familiar with the topic already. Although there is value in beginners reading, they may find themselves feeling lost without having a more solid foundation in both python, application programing and GIS applications specifically.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.