Learning Geospatial Analysis with Python - Fourth Edition

Book description

Harness the powerful Python programming language to navigate the realms of geographic information systems, remote sensing, topography, and more, while embracing a guiding framework for effective geospatial analysis

Key Features

  • Create GIS solutions using the new features introduced in Python 3.10
  • Explore a range of GIS tools and libraries, including PostGIS, QGIS, and PROJ
  • Identify the tools and resources that best align with your specific needs
  • Purchase of the print or Kindle book includes a free PDF eBook

Book Description

Geospatial analysis is used in almost every domain you can think of, including defense, farming, and even medicine. In this special 10th anniversary edition, you'll embark on an exhilarating geospatial analysis adventure using Python.

This fourth edition starts with the fundamental concepts, enhancing your expertise in geospatial analysis processes with the help of illustrations, basic formulas, and pseudocode for real-world applications. As you progress, you’ll explore the vast and intricate geospatial technology ecosystem, featuring thousands of software libraries and packages, each offering unique capabilities and insights. This book also explores practical Python GIS geospatial applications, remote sensing data, elevation data, and the dynamic world of geospatial modeling. It emphasizes the predictive and decision-making potential of geospatial technology, allowing you to visualize complex natural world concepts, such as environmental conservation, urban planning, and disaster management to make informed choices. You’ll also learn how to leverage Python to process real-time data and create valuable information products.

By the end of this book, you'll have acquired the knowledge and techniques needed to build a complete geospatial application that can generate a report and can be further customized for different purposes.

What you will learn

  • Automate geospatial analysis workflows using Python
  • Understand the different formats in which geospatial data is available
  • Unleash geospatial tech tools to create stunning visualizations
  • Create thematic maps with Python tools such as PyShp, OGR, and the Python Imaging Library
  • Build a geospatial Python toolbox for analysis and application development
  • Unlock remote sensing secrets, detect changes, and process imagery
  • Leverage ChatGPT for solving Python geospatial solutions
  • Apply geospatial analysis to real-time data tracking and storm chasing

Who this book is for

This book is for Python developers, researchers, or analysts who want to perform geospatial modeling and GIS analysis with Python. Basic knowledge of digital mapping and analysis using Python or other scripting languages will be helpful.

Table of contents

  1. Learning Geospatial Analysis with Python
  2. Contributors
  3. About the author
  4. Acknowledgments
  5. About the reviewers
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Conventions used
    6. Get in touch
    7. Share your thoughts
    8. Download a free PDF copy of this book
  7. Part 1:The History and the Present of the Industry
  8. Chapter 1: Learning about Geospatial Analysis with Python
    1. Technical requirements
    2. Geospatial analysis and our world
    3. History of geospatial analysis
    4. Evolution of Geographic Information Systems (GISs)
    5. Remote sensing
    6. Point cloud data
    7. Computer-aided drafting
    8. Geospatial analysis and computer programming
      1. Object-oriented programming for geospatial analysis
    9. The importance of geospatial analysis
    10. GIS concepts
      1. Thematic maps
      2. Spatial databases
      3. Spatial indexing
      4. Metadata
      5. Map projections
      6. Rendering
    11. Remote sensing concepts
      1. Images as data
      2. Remote sensing and color
    12. Common vector GIS concepts
      1. Data structures
      2. Buffer
      3. Dissolve
      4. Generalize
      5. Intersection
      6. Merge
      7. Point in polygon
      8. Union
      9. Join
    13. Common raster data concepts
      1. Band math
      2. Change detection
      3. Histogram
      4. Feature extraction
      5. Supervised and unsupervised classification
    14. Creating the simplest possible Python GIS
      1. Getting started with Python
      2. Building a SimpleGIS
    15. Summary
    16. Questions
    17. Further reading
  9. Chapter 2: Learning about Geospatial Data
    1. Technical requirements
    2. Overview of common data formats
    3. Understanding data structures
      1. Common traits
    4. Understanding spatial indexing
      1. Spatial indexing algorithms
    5. What are overviews?
    6. What is metadata?
    7. Understanding the file structure
    8. Knowing about the most widely used vector data types
      1. Shapefiles
      2. CAD files
      3. Tag-based and markup-based formats
      4. GeoJSON
      5. GeoPackage
    9. Understanding raster data types
      1. TIFF files
      2. JPEG, GIF, BMP, and PNG
      3. Compressed formats
      4. ASCII grids
      5. World files
    10. What is point cloud data?
      1. LIDAR
    11. More realistic geospatial models with 3D data
    12. What are web services?
    13. Understanding geospatial databases
    14. Sharing data with interchange formats
    15. Introducing spatiotemporal data
    16. Summary
    17. Questions
    18. Further reading
  10. Chapter 3: The Geospatial Technology Landscape
    1. Technical requirements
    2. Understanding data access
      1. GDAL
      2. PDAL
    3. Understanding computational geometry
      1. The PROJ projection library
      2. CGAL
      3. JTS
      4. GEOS
      5. PostGIS
      6. Other spatially enabled databases
      7. Routing
    4. Understanding desktop tools (including visualization)
      1. Quantum GIS
      2. GRASS GIS
      3. gvSIG
      4. OpenJUMP
      5. Google Earth
      6. NASA WorldWind
      7. ArcGIS
      8. Leaflet and OpenLayers
    5. Understanding metadata management
      1. Python’s pycsw library
      2. GeoNode
      3. GeoNetwork
    6. A quick look at artificial intelligence
    7. Summary
    8. Questions
    9. Further reading
  11. Part 2:Geospatial Analysis Concepts
  12. Chapter 4: Geospatial Python Toolbox
    1. Technical requirements
    2. Using QGIS
    3. Installing third-party Python modules
      1. Anaconda
    4. Jupyter
      1. PyPI and pip
      2. The Python virtualenv module
    5. Python networking libraries for acquiring data
      1. The Python urllib module
      2. The Python requests module
      3. FTP
    6. Bundling and compressing files
    7. Python markup and tag-based parsers
      1. The minidom module
      2. The ElementTree module
      3. Building XML using ElementTree and minidom
    8. Well-Known Text (WKT)
    9. Python JSON libraries
      1. The json module
      2. The geojson module
    10. OGR
    11. PyShp
    12. Shapely
    13. Fiona
    14. GDAL
    15. NumPy
    16. PIL
    17. PNGCanvas
    18. GeoPandas
    19. PyFPDF
    20. PyMySQL
    21. Rasterio
    22. OSMnx
    23. Folium
    24. Summary
    25. Questions
    26. Further reading
  13. Chapter 5: Python and Geospatial Algorithms
    1. Technical requirements
    2. Measuring distance
      1. Using the Pythagorean theorem to measure distance
      2. Using the haversine formula
      3. Using the Vincenty formula
    3. Calculating line direction
    4. Understanding coordinate conversion
    5. Understanding reprojection
    6. Understanding coordinate format conversion
    7. Calculating the area of a polygon
    8. Using ChatGPT to measure a polygon perimeter
    9. Summary
    10. Questions
    11. Further reading
  14. Chapter 6: Creating and Editing GIS Data
    1. Technical requirements
    2. Editing shapefiles
      1. Accessing the shapefile
      2. Changing a shapefile
      3. Adding fields
      4. Merging shapefiles
      5. Splitting shapefiles
      6. Performing selections
      7. Aggregating geometry
      8. Extracting geometry
      9. Connecting polygon faces to the nearest line point
    3. Creating images for visualization
      1. Dot density calculations
      2. Choropleth maps
      3. Using spreadsheets
      4. Creating heat maps
    4. Using GPS data
    5. Turning addresses into points with geocoding
    6. Performing GIS analysis faster with multiprocessing
    7. Summary
    8. Questions
    9. Further reading
  15. Chapter 7: Python and Remote Sensing
    1. Technical requirements
    2. Examining raster data properties
    3. Swapping image bands
    4. Creating image histograms
      1. Performing a histogram stretch
    5. Clipping images
    6. Classifying images
    7. Extracting features from images
    8. Understanding change detection
    9. Extracting image footprints using ChatGPT
    10. Summary
    11. Questions
    12. Further reading
  16. Chapter 8: Python and Elevation Data
    1. Technical requirements
    2. Accessing ASCII Grid files
      1. Reading grids
      2. Writing grids
    3. Creating a shaded relief
    4. Creating elevation contours
    5. Working with LiDAR data
      1. Creating a grid from the LiDAR data
      2. Using PIL to visualize LiDAR data
      3. Creating a triangulated irregular network
      4. Colorizing LiDAR with aerial images
      5. Classifying LiDAR
    6. Working with bathymetry
    7. Summary
    8. Questions
    9. Further reading
  17. Part 3:Practical Geospatial Processing Techniques
  18. Chapter 9: Advanced Geospatial Modeling
    1. Technical requirements
    2. Creating a normalized difference vegetation index (NDVI)
      1. Setting up the framework
      2. Loading the data
      3. Rasterizing the shapefile
      4. Clipping the bands
      5. Using the NDVI formula
      6. Classifying the NDVI
    3. Creating a flood inundation model
      1. The flood fill function
    4. Creating a color hillshade
    5. Performing least cost path analysis
      1. The real-world example
    6. Converting the route to a shapefile
    7. Routing along streets
    8. Geolocating photos
    9. Calculating satellite image cloud cover
    10. Summary
    11. Questions
    12. Further reading
  19. Chapter 10: Working with Real-Time Data
    1. Technical requirements
    2. Limitations of real-time data
    3. Using real-time data
    4. Tracking vehicles
      1. Getting a vehicle location
      2. Mapping a vehicle location
      3. Storm chasing
    5. Gathering reports from the field
    6. Summary
    7. Questions
    8. Further reading
  20. Chapter 11: Putting It All Together
    1. Technical requirements
    2. Understanding a typical GPS report
    3. Building a GPS reporting tool
      1. Importing libraries
      2. Setting up logging
      3. Helper functions
      4. Program variables
      5. Parsing the GPX file
      6. Downloading the basemap and elevation data
      7. Hillshading the elevation data
      8. Creating a map
      9. Adding a photo marker
      10. Creating an elevation profile chart
      11. Creating a weather report
      12. Generating a PDF report
    4. Summary
    5. Questions
    6. Further reading
  21. Assessments
    1. Chapter 1 – Learning about Geospatial Analysis with Python
    2. Chapter 2 – Learning about Geospatial Data
    3. Chapter 3 – The Geospatial Technology Landscape
    4. Chapter 4 – Geospatial Python Toolbox
    5. Chapter 5 – Python and Geospatial Algorithms
    6. Chapter 6 – Creating and Editing GIS Data
    7. Chapter 7 – Python and Remote Sensing
    8. Chapter 8 – Python and Elevation Data
    9. Chapter 9 – Advanced Geospatial Modeling
    10. Chapter 10 – Working with Real-Time Data
    11. Chapter 11 – Putting It All Together
  22. Index
    1. Why subscribe?
  23. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share your thoughts
    3. Download a free PDF copy of this book

Product information

  • Title: Learning Geospatial Analysis with Python - Fourth Edition
  • Author(s): Joel Lawhead
  • Release date: November 2023
  • Publisher(s): Packt Publishing
  • ISBN: 9781837639175