Monday, October 30, 2023

Thank you for making "Learning Geospatial Analysis with Python" #1 on Amazon!

 🚀 Exciting News!! 📚 The 10-year anniversary edition of 🌎 "Learning Geospatial Analysis with Python - 4th Ed," 🐍 is now available on Amazon and it's starting off on fire 🔥 as #1 in the GIS New Release category! 🥇

Thank you to all of my fellow geography-obsessed and Python-loving friends out there for making this book possible. In this edition, I'll help you up your geospatial game with package management in Anaconda and new data types including bathymetric point clouds so you can explore the ocean. Even more exciting I'll show you how to speed up your workflow by using ChatGPT as a tireless geospatial programming assistant.

I bring you up to speed on the entire history of geospatial analysis and then lead you through concepts and major software tools, and then teach you simple geospatial algorithms that will serve as building blocks for the complete programs that come later in the book.

These examples are designed to teach people new to Python and geospatial analysis, but are built to empower experienced practitioners as well with code that you will use everyday for common GIS challenges.

Grab 🖐 your copy 📖 today and start changing the world by analyzing it using one of the most popular programming languages ever created!

Thursday, October 26, 2023

Learning Geospatial Analysis with Python: 10-year Anniversary Edition!

I'm happy to announce the 10-year anniversary of the 1st edition of my book, "Learning Geospatial Analysis with Python". There's a lot of new information in this 4th edition. I've always tried to provide pure Python solutions, but this edition introduces the amazing Anaconda platform which makes installing complex geospatial libraries a breeze. I've also introduced my first example of dealing with hydrographic data as the "Blue Economy" continues to rise. And most importantly, I provide examples of using ChatGPT to assist in quickly creating useful geospatial analysis Python scripts as we move into the age of AI. Available on Amazon:

Friday, August 20, 2021

Connecting MultiPolygon Edges to Lines

This post is another Spatial Thoughts Academy Weekly Challenge solutions. The challenge is to find the edge of the polygon in a set of building footprints whose center point is closest to a street and then connect it with the nearest point on the street.  Shapely and Fiona were of course up to the challenge.  The basic algorithm is to grab the exterior-most ring of the building footprints, break out the edges, determine the midpoint of each edge, measure the distance to each road until the shortest distance is found, then grab the nearest point on the road, and finally draw a line between the edge midpoint and the nearest road point.  Shapely's nearest_points() method is really versatile here because you can throw any two geometries at it even if they are different types.  Fiona is used to read and write geopackages which I'm really liking lately as more an more people are using them finally. Here's the code:

Thursday, August 12, 2021

Extracting MultiPolygons with Holes using Shapely and Fiona recently posted a challenge on LinkedIn to extract only building footprints with holes from a city-wide dataset.  

What made the challenge interesting is the building footprints are MultiPolygons instead of simple Polygons which stumped a few people's attempts. But this challenge is very straight-forward Shapely to select the polygons and Fiona to read and write the data.

The correct feature count if you extract all of the building footprints with holes or polygon inner rings is 45.  The challenge author later demonstrated how to do it in QGIS using a series of expressions.  I think I had the only Python solution. One guy posted a successful answer in R.

The challenge data is a city extracted from OSM:

Here is my solution:

Thursday, October 10, 2019

Learning Geospatial Analysis with Python, 3rd Ed.

Third Edition is on the shelves! Geospatial concepts, Geo-python universe, and pound-for-pound still the most pure-python and minimal-dependency examples you’ll find anywhere so somebody somewhere out there will still be able to do the math.  I'm giving away a few eBook versions if you're willing to write a review on Amazon. DM me @SpatialPython with your name and email!