Pages

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: https://lnkd.in/gBuvbvXD



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

SpatialThoughts.com 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: https://lnkd.in/g7dVqzMx

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! https://bit.ly/35gm0xl

Saturday, January 12, 2019

PotreeConverter Mac Binary

Potree is the amazing javascript WebGL library that can effortlessly display multi-million-point lidar
point clouds in a browser using a static web page.  In order to do that, you have to use PotreeConverter which creates an efficient octree of your LAS file.  But the MacOS built-in compilers with XCode are usually several generations behind and don't like the PotreeConverter source. I was finally able to get it to compile so I created a GitHub repository with the binary and the compile steps.  You still need to download the "resources" directory from the original PotreeConverter repository which contains the viewer webpage template. You may also have to deal with issue https://github.com/potree/PotreeConverter/issues/281 but it's an easy fix.  I have no idea how portable the binary is, but hopefully the compile steps will save time for others.