In this video, I delve into a unique global dataset that merges critical infrastructure data relevant for those of us interested in geospatial analysis and climate science. I showcase how to access and utilize this data, highlighting its storytelling potential and learning opportunities.
Not everyone is interested in diving into a course on Python and Climate Science. As I build the full set of modules that include resources and shorter video snippets along the way - bread crumbs to help build different skills - I also think many of you can learn a few insights at a higher level perhaps relevant to your work.
Open-Source Solutions for Geospatial Analysis is a reader-supported publication. To support this type of work, consider becoming a paid subscriber.
Generated by Loom AI
00:00 Introduction to Data Set
02:49 Detailed Look at the Article
04:45 Running Code and Dataset
Essential Python Libraries: Geospatial Storytelling in Climate Science
explore here → python_libraries
This is a public episode. If you'd like to discuss this with other subscribers or get access to bonus episodes, visit bonnypmcclain.substack.com/subscribe
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
All right, what I'm sharing here with you is this document that started the whole thing. I do a lot of reading and this article is something I'm going to be talking about
SPEAKER_01later on in the video, but it's talking about critical infrastructure. If you're someone who works in geospatial analytics and climate science, this is kind of the background to all that really important information, especially around natural disasters, especially looking at resource allocation and critical infrastructure in need of repair. You could go on and on and on. It's a really good source of storytelling that highlights the skills that we have
SPEAKER_01as geospatial analysts. So this is kind of just like a little review of what the video is going to be. This is part of that critical infrastructure. You can see the light areas on here, obviously around a lot of these big cities. You can see the infrastructure. You can also see it in some of the areas where there's more transportation along the corridor here.
SPEAKER_00You can even see it down here in Panama, near the Panama Canal. And that data set, and I'll step through this quickly,
SPEAKER_01but in a little more context shortly, but if you've never cloned a repository before, that article parked all its data over on GitHub. So to clone, you go to the link, you open it up, and you'll see the readme file, and you see this code button and if you click it you get this link which is what you need to put into your python code to open up all those files just put a pin in that if it's not something familiar to you and these are going to be pbf files which are a little
different and you're going to note that with the code that you write because we have way ids not geometries and you're going to have to change the code accordingly
SPEAKER_01so you can use some of the packages like shapely blah blah blah And what I like to tell people is, you know, GF Fabric does a wonderful, wonderful job of bringing these assets together. You could do it yourself. I don't know why you'd want to because these are 79, 80 gigabytes to get this data and then you have to filter it or you got to figure out what regions you want. You know, GF Fabric does it for free. Obviously, if you want any more curation or analytics, they are a consultancy.
But I always like to let people know that are interested where the raw data is for
SPEAKER_01projects they might be interested in. So now from here, let's look at the article. a little bit of detail I'll leave these here the the it's a harmonized global data set there is no data set like this in existence before of this taking these critical infrastructure systems and putting them into a single file a single
SPEAKER_00database and that's what we have here and you know i'm going to be going through this in more detail in the course but i just wanted you to see the level of the data we're looking at energy transportation telecommunications water waste health education and you know there's point line multi-line polygon features and all the things you can do with the data and then even just the information like right here just looking at these assets right here
I just think it's brilliant and it's gonna generate a lot of learning and a lot of workshops.
SPEAKER_01Then we pop over here, this is where we find the data. so look at it this is all these are all the tips all the dating you recognize some of these OSM tags it's really just the keys and the tags so whatever stories that you want to tell but the data is all in this zip file and you can download specifically what you need for the talk you're gonna you know talk so you want to give it's It's a wonderful asset and I'm going to be stepping through it
for some of the
SPEAKER_01projects we do through some of the courses I'm pulling together. But I just wanted you to have access to this for whatever your needs might be. And just to give you a quick overview, I was running code in here and worked a little bit in the data set, cloned the repository. And I want you to see, and the scripts are right here. These are the Python scripts that you can use to make your grids, to transfer, all of that is right here. You just need to know a little bit about scripting in Python.
SPEAKER_01I give you some examples here. Here's the grid data that we were talking about, the GeoFeather data, which is WKB. And you just need to know A little bit about that structurally. Here's your environmental, your environment YAML, which is where all the dependencies and the files, you know, the packages you're going to need. And, you know, I mounted this to my drive. And then I also pulled up the PBF of Panama, just to use as an example, because as PDF files go, it's a reasonable size.
SPEAKER_01And there's the cloning space up there. There's your link. And I already did all this. I cloned it. You can see all the objects that are in here. And this is what populated my data files that you see over here. And I switched to Python 3.8 because I was having some incompatibility issues. These were just quick fixes because I'm not doing this as a project. I'm doing this to share something with you in a course. So we had to install some things. Some things did better with conda.
SPEAKER_01Some things did better. And, you know, you have to do this when you're doing it, you know, from the console. I mean, from the terminal into your notebook. So we installed. I was having a really good time. I was having a good time with GDAL. I was not getting, this was not cooperating. I kept installing, importing, installing, importing. It wasn't showing up. So I had to use a condo install to do it and an environment. But this is what I mean about learning Python. It's not a recipe.
SPEAKER_01It's not something that you can kind of set it and forget it. And when you write a book, you find this out because people are like, the code doesn't work. Python code isn't evergreen. Things change. Requirements change. The version of Python or one package can change. If you don't know how to troubleshoot that, there's no book in the world that's going to help you. You have to think of these books and tools like pantries, not like recipes. You have to know what tools you have and be able to think on your feet.
And I showed some of the errors I was generating here just so you could see that. this error here was telling me wow you're missing geo you know metadata well i bet i am because it wasn't running because i was using a pandas data frame i didn't i was not using the geopandas data frame easy fix no no problem and then you know from shapely i had to import the wkb so that i could handle the way ids and you
SPEAKER_01know where these links come from where is this data living The grid data that I showed you, you just go in here, copy the path, plug it in. These are all some of the scripts that are already written. I didn't develop these scripts. They're in the package. They're in the cloned package. But you do have to know some things, obviously. You have to know the format of your data. You have to know a little bit about OSM data, that we're going to have points, lines, multilines, polygons, and be able to call for that kind of data.
SPEAKER_01And see, here it said there's no attribute for geom type. And we were able to fix that. I'll show you the fixed file on that. I have to run this whole thing over again to show you how it rendered. But I just wanted to show you a little bit about the code. And then I'll show you the output. So, oh, I'm sorry. What was happening up here, I just glossed over the whole point of the video. Was there's no attribute GM type? That's because there isn't.
SPEAKER_01It's a way ID. So I have to make that change. So, okay, we changed to get the geo data frame. And then here we had no attribute GM type. Well, of course there wasn't because it was a way ID. And then we, what did we do here? Oh, this was the conversion that happened here. Converting and now we have that geodata frame right went from
the bytes over here to Looking something familiar and then we have to pull in things to view to be able
SPEAKER_01to view our data This is a script. I just pulled this script in from the scripting file over here and you you know you have to add in all the dependencies and everything but and you have to know a little bit about osm as i said you need to know what they call the type of data that you're trying to find i'm looking for buildings and you know here they are you know it's nothing expected you can see the intensity you can kind of see that critical infrastructure of where the things tagged as
buildings are
SPEAKER_01located because this isn't just a building. It's tagged with other things, population data. You'll see that when you walk through the article in more detail, how this data was rendered. I used QGIS to open these things up and just say, what is in this file? And that was very helpful because, you know, at first I was like, oh, wastewater. That's always an interesting infrastructure thing to look at. And I'm like, well, But when I went into QGIS and looked for it, it wasn't there. Now, somehow the data set thinks it's there because if it really wasn't there,
SPEAKER_01it would tell me that there wasn't anything to visualize. So there's something going on here that I would dig deeper if I really was looking for that particular data. But I did know that there were pipelines. So all I'm not showing you here is you know this is the script you have to know that when you're looking for pipelines you have to know what the key and the tag is going to be and you can do that by exploring a little in quick osm in pugis or you can go
you know wherever you find this information that's where i go and so i knew i could extract this
SPEAKER_01pipeline data I got this lovely visual I forgot to put a base map so I add it context silly I mean I want you to see the you know the steps you have to take the quick thinking you have to do and you're like wow how did that happen so you just put it back and you can add your visualization how you want to look at your data and Yes, there it is. There's the base map. I had them recolor it in red so I can see it. And I picked OSM.
What I'm letting you escape from is the iterations of base maps that just weren't working. I tried a couple, but I figure OSM data, let's not make more problems than we need to.
SPEAKER_01I just used the OSM base map. And now I had some bigger questions I wanted to ask. I wanted to see what other data I could look at. What else is there? I looked at buildings, I looked at pipelines. So if you run this data set, you can see all the different tags and the keys. So you can find out what type of data is within this, you know, in this infrastructure data. What are we looking at? We're looking at border types, waterways. you know we're looking at you know all kinds of things place
things with place recycling cross it knowing the data set is what's going to help you you know i pulled i just looked at 100 rows here so i could get a little more information you could run the whole darn data set if you want to find out or you just you know it's so much easier just to go into QGIS and and pull it up that way so that's just a
SPEAKER_01quick review of what's in the course and we'll pause a little bit at some of these so that you can kind of, you know, work at your own pace, kind of adjust in time.
My mind hasn’t settled enough for me to cogitate everything inspirational from Life After Data: the conference on de-datafication. The Privacy Center at Georgetown Law will be releasing a summation that I eagerly await....
This is a free preview of a paid episode. To hear more, visit bonnypmcclain.substack.com Patti Smith and Katie Couric Life After Data: the conference on de-datafication
Any Haruki Murakami fans out there? While in Japan I picked. up a few of my favorites while wandering around Jimbocho. You likely are aware that certain book covers are only available in their international markets or...
Think about your skill toolbox. I have been an exercise scientist, bench scientist, chiropractor, medical writer, pharma data scientist, geospatial data scientist and most recently the manifestation of all of these...
Here is the thing. Being a geospatial science professional requires, or let’s see, is enhanced by skills in tech, spatial awareness, geography and adjacent disciplines. There is an economy around all of it. Who do you...