Reader small image

You're reading from  Mastering Geospatial Analysis with Python

Product typeBook
Published inApr 2018
Reading LevelBeginner
PublisherPackt
ISBN-139781788293334
Edition1st Edition
Languages
Right arrow
Authors (3):
Silas Toms
Silas Toms
author image
Silas Toms

Silas Toms is a long-time geospatial professional and author who has previously published ArcPy and ArcGIS and Mastering Geospatial Analysis with Python. His career highlights include developing the real-time common operational picture used at Super Bowl 50, building geospatial software for autonomous cars, designing computer vision for next-gen insurance, and developing mapping systems for Zillow. He now works at Volta Charging, predicting the future of electric vehicle adoption and electric charging infrastructure.
Read more about Silas Toms

Paul Crickard
Paul Crickard
author image
Paul Crickard

Paul Crickard authored a book on the Leaflet JavaScript module. He has been programming for over 15 years and has focused on GIS and geospatial programming for 7 years. He spent 3 years working as a planner at an architecture firm, where he combined GIS with Building Information Modeling (BIM) and CAD. Currently, he is the CIO at the 2nd Judicial District Attorney's Office in New Mexico.
Read more about Paul Crickard

Eric van Rees
Eric van Rees
author image
Eric van Rees

Eric van Rees was first introduced to Geographical Information Systems (GIS) when studying Human Geography in the Netherlands. For 9 years, he was the editor-in-chief of GeoInformatics, an international GIS, surveying, and mapping publication and a contributing editor of GIS Magazine. During that tenure, he visited many geospatial user conferences, trade fairs, and industry meetings. He focuses on producing technical content, such as software tutorials, tech blogs, and innovative new use cases in the mapping industry.
Read more about Eric van Rees

View More author details
Right arrow

Preface

Over time, Python has become the programming language of choice for spatial analysis, resulting in many packages that read, convert, analyze, and visualize spatial data. With so many packages available, it made sense to create a reference book for students and experienced professionals containing essential geospatial Python libraries for Python 3.

This book also comes at an exciting moment: new technology is transforming how people work with geospatial data – IoT, machine learning, and data science are areas where geospatial data is used constantly. This explains the inclusion of new Python libraries, such as CARTOframes and MapboxGL, and Jupyter is included as well, to explore these new trends. At the same time, web and cloud-based GIS is increasingly becoming the new standard. This is reflected in the chapters of the second part of this book, where interactive geospatial web maps and REST APIs are introduced.

These newer libraries are combined with a number of older ones that have become essential over the years, and are still very popular to this day, such as Shapely, Rasterio, and GeoPandas. Readers who are new to this field will be given a proper introduction to popular libraries, putting them into perspective and comparing their syntax through code examples using real-world data.

Finally, this books marks the transition from Python 2 to 3.x. All of the libraries covered in this book were written in Python 3.x so that the readers can access all of them using Jupyter Notebook, which is also the recommended Python coding environment for this book.

Who this book is for

This book is for anyone who works with location information and Python. Students, developers, and geospatial professionals can all use this reference book, as it covers GIS data management, analysis techniques, and code libraries built with Python 3.

What this book covers

Chapter 1, Package Installation and Management, explains how to install and manage the code libraries used in the book.

Chapter 2, Introduction to Geospatial Code Libraries, covers the major code libraries used to process and analyze geospatial data.

Chapter 3, Introduction to Geospatial Databases, introduces the geospatial databases used for data storage and analysis.

Chapter 4, Data Types, Storage, and Conversion, focuses on the many different data types (both vector and raster) that exist within GIS.

Chapter 5, Vector Data Analysis, covers Python libraries such as Shapely, OGR, and GeoPandas. which are used for analyzing and processing vector data.

Chapter 6, Raster Data Processing, explores using GDAL and Rasterio to process raster datasets in order to perform geospatial analysis.

Chapter 7, Geoprocessing with Geodatabases, shows the readers how to use Spatial SQL to perform geoprocessing with database tables containing a spatial column.

Chapter 8, Automating QGIS Analysis, teaches the readers how to use PyQGIS to automate analysis within the QGIS mapping suite.

Chapter 9, ArcGIS API for Python and ArcGIS Online, introduces the ArcGIS API for Python, which enables users to interact with Esri's cloud platform, ArcGIS Online, using Python 3.

Chapter 10, Geoprocessing with a GPU Database, covers using Python tools to interact with cloud-based data to search and process data.

Chapter 11, Flask and GeoAlchemy2, describes how to use the Flask Python web framework and the GeoAlchemy ORM to perform spatial data queries.

Chapter 12, GeoDjango, covers using the Django Python web framework and the GeoDjango ORM to perform spatial data queries.

Chapter 13, Geospatial REST API, teaches the readers how to create a REST API for geospatial data.

Chapter 14, Cloud Geodatabase Analysis and Visualization, introduces the readers to the CARTOframes Python package, enabling the integration of Carto maps, analysis, and data services into data science workflows.

Chapter 15, Automating Cloud Cartography, covers a new location data visualization library for Jupyter Notebooks.

Chapter 16, Python Geoprocessing with Hadoop, explains how to perform geospatial analysis using distributed servers.

To get the most out of this book

As this book covers Python, it is assumed that the reader has a basic understanding of the Python language, can install Python libraries, and knows how to write and run Python scripts. As for additional knowledge, the first six chapters can easily be understood without any previous knowledge of geospatial data analysis. However, later chapters assume some knowledge of spatial databases, big data platforms, data science, web APIs, and Python web frameworks.

Download the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packtpub.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Mastering-Geospatial-Analysis-with-Python. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/MasteringGeospatialAnalysiswithPython_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Select a folder and save the key, which will now have a .ppk file extension."

A block of code is set as follows:

cursor.execute("SELECT * from art_pieces")
data=cursor.fetchall()
data

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

from pymapd import connect
connection = connect(user="mapd", password= "{password}", 
     host="{my.host.com}", dbname="mapd")
cursor = connection.cursor()
sql_statement = """SELECT name FROM county;"""
cursor.execute(sql_statement)

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

conda install -c conda-forge geos

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "To generate the pair from the EC2 Dashboard, select Key Pairs from the NETWORK & SECURITY group in the left panel after scrolling down."

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email feedback@packtpub.com and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at questions@packtpub.com.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packtpub.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packtpub.com.

 

 

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering Geospatial Analysis with Python
Published in: Apr 2018Publisher: PacktISBN-13: 9781788293334
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (3)

author image
Silas Toms

Silas Toms is a long-time geospatial professional and author who has previously published ArcPy and ArcGIS and Mastering Geospatial Analysis with Python. His career highlights include developing the real-time common operational picture used at Super Bowl 50, building geospatial software for autonomous cars, designing computer vision for next-gen insurance, and developing mapping systems for Zillow. He now works at Volta Charging, predicting the future of electric vehicle adoption and electric charging infrastructure.
Read more about Silas Toms

author image
Paul Crickard

Paul Crickard authored a book on the Leaflet JavaScript module. He has been programming for over 15 years and has focused on GIS and geospatial programming for 7 years. He spent 3 years working as a planner at an architecture firm, where he combined GIS with Building Information Modeling (BIM) and CAD. Currently, he is the CIO at the 2nd Judicial District Attorney's Office in New Mexico.
Read more about Paul Crickard

author image
Eric van Rees

Eric van Rees was first introduced to Geographical Information Systems (GIS) when studying Human Geography in the Netherlands. For 9 years, he was the editor-in-chief of GeoInformatics, an international GIS, surveying, and mapping publication and a contributing editor of GIS Magazine. During that tenure, he visited many geospatial user conferences, trade fairs, and industry meetings. He focuses on producing technical content, such as software tutorials, tech blogs, and innovative new use cases in the mapping industry.
Read more about Eric van Rees