Book Image

Mastering Geospatial Analysis with Python

By : Silas Toms, Paul Crickard, Eric van Rees
Book Image

Mastering Geospatial Analysis with Python

By: Silas Toms, Paul Crickard, Eric van Rees

Overview of this book

Python comes with a host of open source libraries and tools that help you work on professional geoprocessing tasks without investing in expensive tools. This book will introduce Python developers, both new and experienced, to a variety of new code libraries that have been developed to perform geospatial analysis, statistical analysis, and data management. This book will use examples and code snippets that will help explain how Python 3 differs from Python 2, and how these new code libraries can be used to solve age-old problems in geospatial analysis. You will begin by understanding what geoprocessing is and explore the tools and libraries that Python 3 offers. You will then learn to use Python code libraries to read and write geospatial data. You will then learn to perform geospatial queries within databases and learn PyQGIS to automate analysis within the QGIS mapping suite. Moving forward, you will explore the newly released ArcGIS API for Python and ArcGIS Online to perform geospatial analysis and create ArcGIS Online web maps. Further, you will deep dive into Python Geospatial web frameworks and learn to create a geospatial REST API.
Table of Contents (23 chapters)
Title Page
Copyright and Credits
Packt Upsell
Geoprocessing with Geodatabases

Introducing Anaconda

Anaconda is a freemium open source distribution of the Python programming language for large-scale data processing, predictive analytics, and scientific computing, that aims to simplify package management and deployment. It is also the world's most popular Python data science platform, with over 4.5 million users and 1,000 data science packages. It is not to be confused with conda, a package manager that is installed with Anaconda.

For this book, we recommend installing and using Anaconda as it provides you everything you need—Python itself, Python libraries, the tools to manage these libraries, a Python environment manager, and the Jupyter Notebook application to write, edit, and run your code. You can also choose to use an alternative to Anaconda or install Python through and use any IDE of your choice combined with a package manager such as pip (covered as we proceed further). We recommend using Python version 3.6.

Installing Python using Anaconda

A free download of the latest version of Anaconda, available for Windows, macOS, and Linux is available at the homepage of Continuum Analytics. At the time of writing, the latest version is Anaconda 5.0.1, released in October 2017 and available in 32 and 64-bit versions from This page also offers extensive download instructions for each operating system, a 30-minute tutorial that explains how to use Anaconda, a cheat sheet on how to get started, and an FAQ section. There's also a slimmed-down version of Anaconda called Miniconda that only installs Python and the conda package manager, leaving out the 1000+ software packages that come with the standard installation of Anaconda: If you decide to use this, make sure you download the Python 3.6 version.

Anaconda will install Python 3.6.2 as the default Python version on your machine. The Python version that is used in all chapters of this book is Python 3.6, so you're good with any version that starts with 3.6 or higher. With Anaconda, you get more than 1,000 Python packages, as well as a number of applications, such as Jupyter Notebook, and a variety of Python consoles and IDEs.

Please note that you are not forced to always use Python version 3.6 after installing it—using Anaconda Navigator (a GUI for managing local environments and installing packages), you can also choose to use Python 3.5 or 2.7 in a virtual environment. This gives you more flexibility in switching between different Python versions for various projects.

To begin the installation, download the 32-or 64-bit Anaconda installer, depending on your system capabilities. Open the installation and follow the setup guide to install Anaconda on your local system.