top of page

The Dad World Group

Public·17 members

Geoprocessing With Python


This book is about the science of reading, analyzing, and presenting geospatial data programmatically, using Python. Thanks to dozens of open source Python libraries and tools, you can take on professional geoprocessing tasks without investing in expensive proprietary packages like ArcGIS and MapInfo. The book shows you how.




Geoprocessing with Python



  • Geoprocessing with Python teaches you how to access available datasets to make maps or perform your own analyses using free tools like the GDAL, NumPy, and matplotlib Python modules. Through lots of hands-on examples, you'll master core practices like handling multiple vector file formats, editing geometries, applying spatial and attribute filters, working with projections, and performing basic analyses on vector data. The book also covers how to manipulate, resample, and analyze raster data, such as aerial photographs and digital elevation models. what's inside Geoprocessing from the ground up

  • Read, write, process, and analyze raster data

  • Visualize data with matplotlib

  • Write custom geoprocessing tools

  • Three additional appendixes available online

about the reader To read this book all you need is a basic knowledge of Python or a similar programming language.


This material is really old and some of it is outdated (not all, though!). One of these days I might get around to putting newer class materials online, but you're stuck with this for now. Or if you really want to spend money, I've written a book called Geoprocessing with Python.


Written by Chris Gerard, a Research Associate for the RS/GIS Lab at the Utah State University for over a decade. The book covers geoprocessing with Python using open source libraries. The first introductory chapter is available for free.


Geoprocessing is the science of reading, analyzing, and presenting geospatial data programmatically. The Python language, along with dozens of open source libraries and tools, makes it possible to take on professional geoprocessing tasks without investing in expensive proprietary packages like ArcGIS and MapInfo.


This book is about the science of reading, analyzing, andpresenting geospatial data programmatically, using Python. Thanksto dozens of open source Python libraries and tools, you can takeon professional geoprocessing tasks without investing in expensiveproprietary packages like ArcGIS and MapInfo. The book shows youhow.


ArcGIS uses geoprocessing tools to accomplish many of these tasks. A geoprocessing tool is simply a function that performs an operation on GIS data. A typical geoprocessing operation takes an input dataset, performs an operation on that dataset, and returns the result of the operation as an output dataset. Common geoprocessing operations include geographic feature overlay, feature selection and analysis, topology processing, raster processing, and data conversion. Geoprocessing allows for definition, management, and analysis of information used to form decisions.


The ArcGIS API for Python provides a pythonic programming interface for ArcGIS geoprocessing functionality. Geoprocessing is an integral part of a GIS, and the Python API reflects this notion in the design of its modules. The arcgis package is organized into modules which provide a scientific programming interface for the various spatial capabilities or geographic datasets in the GIS. These modules include a family of functions(geoprocessing tools), types and other helper objects for working with spatial data of a particular type.


The arcgis.features module is used for working with feature data, feature layers and collections of feature layers in the GIS. It also contains the spatial analysis geoprocessing tools which operate on feature data.


Geoprocessing tools are represented as functions in the API, and are located within the module representing the type of spatial data they apply to. Developers simply import the modules in their programs, and use the types and functions defined therein to perform geoprocessing.


The Processing Toolbox in QGIS contain an ever-growing collection of geoprocessing tools. The toolbox provides an easy batch processing interface to run any algorithm on a large number of inputs. See Batch Processing using Processing Framework (QGIS3). But there are cases where you need to incorporate a little bit of custom logic in your batch processing. As all the processing algorithms can be run programmatically via the Python API, you can run them via the Python Console. This tutorial shows how to run a processing algorithm via the Python Console to perform a custom geoprocessing task in just a few lines of code. Please review the Getting Started With Python Programming (QGIS3) tutorial to get familiar with the basics of the Python Scripting environment in QGIS.


The data is provided in the BIL format. Each layer is presented with a set of files .bil file containing the actual data, a .hdr file describing the data structure and a .prj file containing the projection information. QGIS can load the .bil file and provided the other files exist in the same directory.


A new layer output will be added to the canvas, right-click on the layer and select Open Attribute Table. 01_mean represents one month mean, likewise the above algorithm will produce 12 new layers if executed without the break.


The main purpose of the PyProj library is how it works with spatial referencing systems. It can project and transform coordinates with a range of geographic reference systems. PyProj can also perform geodetic calculations and distances for any given datum.


Just like ipyleaflet, Folium allows you to leverage leaflet to build interactive web maps. It gives you the power to manipulate your data in Python, then you can visualize it with the leading open-source JavaScript library.


Geemap is intended more for science and data analysis using Google Earth Engine (GEE). Although anyone can use this Python library, scientists and researchers specifically use it to explore the multi-petabyte catalog of satellite imagery in GEE for their specific applications and uses with remote sensing data.


Chris has a Diploma in GIS from Centre of Geographic Sciences (COGS) and has over seven years of industry experience. This includes ArcGIS for Desktop, ArcGIS Pro and Portal for ArcGIS with a focus on designing, automating and implementing workflows for quality assurance and control using Python. Additionally, he has experience managing road networks as well as designing and implementing custom geocoding solutions.


Not all Python libraries are compatible with each other, and sometimes you will want to have a stable install of a collection packages, and then a separate install for development with the latest versions. Python virtual environments are basically independent installs that allow you to install multiple collections of Python libraries on the same computer. A package manager like Anaconda is typically used to create and manage virtual environments.


A Python environment comes with useful functionality right off the bat, and further functionality is stored in the libraries that extend Python functionality. There are many open-source libraries available that can be installed in a Python environment with pip or Anaconda. We will get into how to install libraries and set up a geospatial Python environment in future articles.


Shapely is a computational geometry library based on the C/C++ library, GEOS (the software engine behind PostGIS) and Java library JTS. It enables PostGIS style geometric processing outside of a relational database management system, and outside of SQL. Shapely does need to be combined with other libraries to read and write spatial files.


Numpy, the classic Python library for working with multidimensional array data structures. When combined with a reader/writer library like LasPy, we can store point cloud data in a NumPy array, as well as filter/process the data (see this tutorial for an example). NumPy is also good for general use across the geospatial domain.


Make interactive maps within a Jupyter Notebook environment. Ipyleaflet is a bridge library that brings the Javascript mapping capability of leaflet.js to Python. It is built on Ipywidgets which provide interactive UI features.


Of course, the queries we can use with the query(...) function can be much more complex and logically connect different conditions. The attributes of the features in our result set are stored in a dictionary called attributes for each of the features. The following loop goes through the features in our result set and prints out their name (f.attributes['NAME']) and state (f.attributes['STATEABB']) to verify that we only have cities for Pennsylvania now:


The College of Earth and Mineral Sciences is committed to making its websites accessible to all users, and welcomes comments or suggestions on access improvements. Please send comments or suggestions on accessibility to the site editor. The site editor may also be contacted with questions or comments about this Open Educational Resource.


So far, we worked with Python as a standalone program, utilizing both the standard library and third-party packages. In addition to this mode of operation, the Python language is often used to automate other programs. For example, when working with a GUI (Graphical User Interface) GIS software, such as ArcGIS Pro or QGIS, it can be exhausting and non-reproducible to perform repetitive tasks and workfows. It is advantageous to write-up such workflows as Python scripts, so that they can be easily reproduced for different data or shared with colleagues.


Automating workflows within GIS software, such as ArcGIS Pro or QGIS, is made possible through their accompanying Python packages, arcpy and PyQGIS, respectively. As we are going to see in this chapter, the specialized Python packages such as arcpy provide access to the entire functionality of the program, including the various data management and processing tools, so that a particular workflow can be described in a reproducible Python script. 041b061a72


About

Welcome to the group! You can connect with other members, ge...
bottom of page