WEBVTT

00:00:00.001 --> 00:00:04.920
On this episode, I'm joined by Dr. Jeff Boeing, an assistant professor at the University of Southern California,

00:00:05.260 --> 00:00:08.720
whose research spans urban planning, spatial analysis, and data science.

00:00:09.240 --> 00:00:14.100
We explore why OpenStreetMap is such a powerful source of global map data,

00:00:14.300 --> 00:00:21.120
and how Jeff's Python library, OSMNX, makes that data easier to download, model, and visualize with Python.

00:00:21.680 --> 00:00:24.480
Along the way, we talk about what shapes city streets around the world,

00:00:24.780 --> 00:00:29.720
how urban design influences everything from daily commutes to disaster resilience,

00:00:30.260 --> 00:00:36.420
and why turning open data into accessible tools can open up completely new ways of understanding

00:00:36.540 --> 00:00:41.620
our cities. If you've ever wondered how to build or analyze your own digital maps in Python,

00:00:42.460 --> 00:00:46.840
you won't want to miss this conversation. This is Talk Python To Me, episode 495,

00:00:47.760 --> 00:00:51.320
recorded Thursday, January 16th, 2025.

00:00:51.420 --> 00:01:09.600
Welcome to Talk Python To Me, a weekly podcast on Python. This is your host, Michael Kennedy.

00:01:09.880 --> 00:01:15.000
Follow me on Mastodon, where I'm @mkennedy, and follow the podcast using @talkpython,

00:01:15.460 --> 00:01:20.739
both accounts over at fosstodon.org. And keep up with the show and listen to over nine years

00:01:20.740 --> 00:01:25.960
of episodes at talkpython.fm. If you want to be part of our live episodes, you can find

00:01:26.040 --> 00:01:31.720
the live streams over on YouTube, subscribe to our YouTube channel over at talkpython.fm/youtube

00:01:31.800 --> 00:01:37.260
and get notified about upcoming shows. This episode is sponsored by Posit Connect from

00:01:37.360 --> 00:01:41.860
the makers of shiny, publish, share and deploy all of your data projects that you're creating

00:01:41.900 --> 00:01:50.059
using Python streamlet dash shiny bokeh FastAPI flask quarto reports, dashboards and API's

00:01:50.060 --> 00:01:51.740
Posit Connect supports all of them.

00:01:52.020 --> 00:01:53.120
Try Posit Connect for free

00:01:53.500 --> 00:01:57.380
by going to talkpython.fm/posit, P-O-S-I-T.

00:01:58.300 --> 00:02:00.320
And it's also brought to you by us

00:02:00.620 --> 00:02:01.880
over at Talk Python Training.

00:02:02.340 --> 00:02:06.540
Did you know that we have over 250 hours of Python courses?

00:02:07.280 --> 00:02:07.700
Yeah, that's right.

00:02:07.840 --> 00:02:10.380
Check them out at talkpython.fm/courses.

00:02:11.540 --> 00:02:13.160
Jeff, welcome to Talk Python To Me.

00:02:13.560 --> 00:02:14.420
- Thank you for having me.

00:02:14.800 --> 00:02:15.860
- It's great to have you here.

00:02:16.500 --> 00:02:20.040
We're gonna talk maps and consuming map data

00:02:20.040 --> 00:02:23.100
a lot of interesting research that you've done with that data.

00:02:23.360 --> 00:02:29.320
So you have a very cool project, OSMNX, Open Street Map Network X,

00:02:29.840 --> 00:02:30.760
that we're going to dive into.

00:02:31.220 --> 00:02:34.960
And it really makes all of this street and map data

00:02:35.500 --> 00:02:37.500
super accessible to users of Python, right?

00:02:37.880 --> 00:02:38.580
- Yeah. - Yeah.

00:02:39.060 --> 00:02:40.640
Excellent. I'm really looking forward to talking about that.

00:02:40.800 --> 00:02:43.680
Before we dive into it though, just a quick introduction.

00:02:44.140 --> 00:02:44.460
Who are you?

00:02:44.840 --> 00:02:45.780
- My name is Jeff Boeing.

00:02:45.940 --> 00:02:47.280
I'm an assistant professor

00:02:47.700 --> 00:02:50.020
at the University of Southern California

00:02:50.020 --> 00:02:55.280
in Los Angeles. I'm in its Department of Urban Planning and Spatial Analysis. And

00:02:55.340 --> 00:03:00.080
most of my research and teaching are around that intersection of urban

00:03:00.160 --> 00:03:05.560
planning and spatial analysis. I did my PhD in city planning at UC Berkeley and

00:03:05.560 --> 00:03:11.780
my focus is on urban data science. So using Python tools, usually open data, to

00:03:11.840 --> 00:03:16.500
try to understand cities and housing markets and transportation networks and

00:03:16.500 --> 00:03:17.740
how people move through space,

00:03:18.120 --> 00:03:21.040
how we can make our cities more resilient

00:03:21.260 --> 00:03:24.060
to natural disasters, which is relevant in LA this week.

00:03:24.740 --> 00:03:28.340
Also more equitable, nicer places to walk around,

00:03:28.460 --> 00:03:31.060
and basically just better for urban living.

00:03:31.320 --> 00:03:34.660
- Okay, well, that sounds like amazing, amazing research.

00:03:35.020 --> 00:03:36.560
It's probably interesting to live in LA

00:03:36.680 --> 00:03:40.040
as one of the bigger, crazier locations

00:03:40.300 --> 00:03:43.580
in terms of traffic and congestion and population.

00:03:43.860 --> 00:03:45.180
It's not New York in terms of density,

00:03:45.340 --> 00:03:47.780
but it's probably its own special beast, I imagine.

00:03:48.160 --> 00:03:48.880
- Yeah, it is.

00:03:49.200 --> 00:03:52.480
LA is an ironic place to be an urban planning professor

00:03:52.620 --> 00:03:53.900
because it can be so frustrating

00:03:54.700 --> 00:03:57.520
for a lot of our best practices in urban planning,

00:03:57.680 --> 00:03:58.500
but at the same time,

00:03:58.920 --> 00:04:01.680
there is no better place in the US to be studying

00:04:01.720 --> 00:04:04.140
and trying to intervene into some of these crises

00:04:04.340 --> 00:04:05.660
that urban planning has wrought.

00:04:06.380 --> 00:04:08.020
- Yeah, yeah, a lot of it was just,

00:04:08.300 --> 00:04:11.260
I imagine in the early days, just a free for all, right?

00:04:11.320 --> 00:04:13.920
There was people, especially out in the West, right?

00:04:14.040 --> 00:04:16.700
the US West, people just move out there

00:04:16.760 --> 00:04:18.359
and there's not a whole lot going on.

00:04:18.480 --> 00:04:20.900
So when a city just neighborhoods go that way

00:04:21.040 --> 00:04:24.120
and not quite enough density for a lot of public transit

00:04:24.460 --> 00:04:25.680
makes it challenging.

00:04:26.020 --> 00:04:27.080
And then they become huge cities

00:04:27.480 --> 00:04:28.700
but they're stuck with those consequences.

00:04:29.200 --> 00:04:30.320
Like LA and other cities. - Yeah, exactly.

00:04:30.800 --> 00:04:33.740
And it's hard to retrofit a city once it's built out

00:04:33.820 --> 00:04:36.720
because those are people's homes and private properties

00:04:36.920 --> 00:04:39.280
that you can't just cut from whole cloth,

00:04:39.580 --> 00:04:40.600
lay down the new city plan.

00:04:40.900 --> 00:04:41.540
- Yeah, yeah.

00:04:41.960 --> 00:04:44.360
Are there cities out there that are basically planned

00:04:44.460 --> 00:04:45.260
from scratch?

00:04:46.220 --> 00:04:49.040
- Yeah, there are places like Brasilia,

00:04:49.460 --> 00:04:53.860
the capital of Brazil was a master planned city

00:04:54.460 --> 00:04:57.540
in the modernist era, mid-century city planning

00:04:57.740 --> 00:04:59.640
where it's designed to look almost like the shape

00:04:59.680 --> 00:05:02.020
of an airplane for the jet age,

00:05:02.220 --> 00:05:03.640
a modern city for the jet age.

00:05:03.820 --> 00:05:04.240
- Amazing.

00:05:04.860 --> 00:05:07.860
- But there's a wide range of how cities come to be.

00:05:08.040 --> 00:05:09.180
Some of them are very organic,

00:05:09.360 --> 00:05:11.940
like you think old medieval cities

00:05:11.940 --> 00:05:13.560
have formed over centuries.

00:05:14.000 --> 00:05:17.200
There are places like LA that built out very rapidly,

00:05:17.320 --> 00:05:20.380
or like in Chicago, all these straight lines

00:05:20.660 --> 00:05:25.120
following from these 19th century ideas of rationality

00:05:25.200 --> 00:05:27.180
and orthogonal street networks.

00:05:28.120 --> 00:05:30.100
And then there are these master plan cities

00:05:30.300 --> 00:05:33.520
where strong central leadership lets you lay it down

00:05:33.880 --> 00:05:35.540
however you think is best.

00:05:36.520 --> 00:05:39.820
- I imagine that how the cities are built

00:05:39.820 --> 00:05:43.380
has a lot to do with the people who helped construct the city

00:05:43.460 --> 00:05:45.940
or there in the early days, how they perceived distance.

00:05:46.440 --> 00:05:50.040
People perceived distance in LA by how far can you go

00:05:50.100 --> 00:05:51.160
in a car in 20 minutes.

00:05:51.460 --> 00:05:53.600
The people perceived distance in Stuttgart,

00:05:54.060 --> 00:05:55.000
how far can you walk?

00:05:55.280 --> 00:05:57.480
Maybe you can take a horse, potentially.

00:05:58.260 --> 00:05:59.740
And that really probably changes things.

00:06:00.340 --> 00:06:02.940
- Yeah, you know what, one way we talk about that idea

00:06:03.020 --> 00:06:04.420
of the perception of distance

00:06:04.580 --> 00:06:06.940
and how the urban form shapes up

00:06:07.260 --> 00:06:09.800
is this idea of transportation technologies

00:06:09.800 --> 00:06:15.560
And in general, you really see something of a death of geography.

00:06:15.840 --> 00:06:22.740
That is, if you look at a 1990s suburb of Philadelphia or of Los Angeles, they look

00:06:22.960 --> 00:06:24.280
very similar to each other.

00:06:24.660 --> 00:06:27.340
You don't see that sort of local culture.

00:06:27.800 --> 00:06:32.560
What you see is really building around the transportation technology and design aesthetic

00:06:32.800 --> 00:06:36.580
of the era, rather than the local hands building the place up.

00:06:36.960 --> 00:06:39.520
And it's, you know, when cars are how you get around,

00:06:39.680 --> 00:06:41.480
you build a city, it's designed for cars.

00:06:41.860 --> 00:06:44.240
- Yeah, and then the cars get to be huge SUVs

00:06:44.280 --> 00:06:45.000
and they still don't fit.

00:06:45.260 --> 00:06:45.600
All right.

00:06:47.360 --> 00:06:49.980
Let's talk, you have this really cool visualization,

00:06:50.540 --> 00:06:52.740
which I'm going to link to in the show notes,

00:06:53.100 --> 00:06:55.940
called City Street Orientations Around the World.

00:06:56.360 --> 00:06:59.880
And it's got some pretty wild graphics.

00:07:00.080 --> 00:07:01.300
You wanna tell people about this

00:07:01.360 --> 00:07:04.220
and kinda try to describe it for the folks listening?

00:07:04.840 --> 00:07:08.600
Yeah, so what these show is the orientation

00:07:09.300 --> 00:07:10.360
of your city streets.

00:07:10.420 --> 00:07:12.120
By orientation, we mean on a compass.

00:07:12.400 --> 00:07:14.480
Like, do they point north, south, east, west?

00:07:15.540 --> 00:07:18.660
Are they off that north, south, east, west orientation?

00:07:19.140 --> 00:07:21.600
Or do your streets point more chaotically

00:07:21.720 --> 00:07:23.660
in all directions around the compass?

00:07:23.760 --> 00:07:26.340
Like, there isn't a more consistent orientation.

00:07:26.800 --> 00:07:30.200
So to visualize these, I used what's basically

00:07:30.360 --> 00:07:33.500
just a histogram, but it's a polar histogram.

00:07:33.800 --> 00:07:37.420
So where a normal histogram will count your observations

00:07:37.720 --> 00:07:40.200
across some set of bins, for a polar histogram,

00:07:40.380 --> 00:07:44.020
we've wrapped those bins around the circle of a compass

00:07:44.420 --> 00:07:49.100
so that each bin represents 10 degrees around the compass.

00:07:49.180 --> 00:07:52.620
And there's 36 bins total for 360 degrees around the circle.

00:07:53.460 --> 00:07:56.640
And then the length of each of the bars in those bins

00:07:57.120 --> 00:07:59.100
represents the frequency of streets

00:07:59.540 --> 00:08:01.860
pointing in that direction in the city.

00:08:02.400 --> 00:08:08.140
So in a place like Chicago or Beijing on screen here,

00:08:08.520 --> 00:08:10.960
most of the streets point north, south, east, west.

00:08:11.060 --> 00:08:13.920
And what that tells us is it's kind of grid-like.

00:08:14.120 --> 00:08:16.140
And this is common in a lot of cities around the world.

00:08:16.960 --> 00:08:19.180
Even a lot of pre-modern cities

00:08:19.500 --> 00:08:21.440
would still orient themselves generally

00:08:21.700 --> 00:08:22.660
north, south, east, west,

00:08:22.740 --> 00:08:25.660
just based on patterns where the sun was rising and setting.

00:08:25.740 --> 00:08:27.800
- Yeah, I'm super surprised to see, for example,

00:08:27.920 --> 00:08:30.680
of Barcelona is pretty, not north-south,

00:08:30.760 --> 00:08:32.099
but it's 90 degrees.

00:08:32.460 --> 00:08:36.360
- Yeah, so in Barcelona, you see that 19th century

00:08:36.520 --> 00:08:40.039
and early 20th century, Eixample development.

00:08:40.560 --> 00:08:42.599
So around medieval old Barcelona,

00:08:43.200 --> 00:08:46.520
El Defensor de la Dada laid out his grand city plan

00:08:46.960 --> 00:08:48.680
that is fairly grid-like around it.

00:08:48.740 --> 00:08:49.680
You can really see that here.

00:08:49.780 --> 00:08:50.280
- Yeah, absolutely.

00:08:50.680 --> 00:08:52.640
For people listening, some of them look like

00:08:53.000 --> 00:08:54.600
airplane fore-blade propellers,

00:08:54.920 --> 00:08:56.840
and some look maybe like boat propellers,

00:08:57.000 --> 00:08:59.400
like really dense, but yeah, it's quite wild

00:08:59.580 --> 00:09:01.480
to get a quick look.

00:09:01.820 --> 00:09:02.760
Do we have LA in there?

00:09:02.840 --> 00:09:03.460
We must, right?

00:09:04.380 --> 00:09:05.800
- I have LA in the big one.

00:09:06.060 --> 00:09:08.400
If you scroll down, we have American cities.

00:09:08.820 --> 00:09:09.900
- Oh yeah, yeah, yeah.

00:09:10.220 --> 00:09:10.880
Okay. - Yeah, there it is.

00:09:11.320 --> 00:09:12.360
- That's a pretty stark contrast.

00:09:12.720 --> 00:09:14.820
It's like all of them are propeller looking.

00:09:15.060 --> 00:09:17.480
Other than Boston and interestingly, Charlotte.

00:09:18.020 --> 00:09:19.480
Boston has a city. - Yeah, really interesting.

00:09:19.940 --> 00:09:21.640
- Yeah, but Charlotte doesn't feel like a city

00:09:21.820 --> 00:09:23.100
like that to me, but what do we have?

00:09:23.120 --> 00:09:26.500
- Yeah, so Boston is kind of one of those pre-modern,

00:09:26.800 --> 00:09:32.000
American cities. And its street orientation looks like that for a couple

00:09:32.100 --> 00:09:36.480
of reasons. One, Boston is an agglomeration of multiple smaller towns

00:09:36.820 --> 00:09:41.080
over several centuries and each of them had grids to some extent but they didn't

00:09:41.140 --> 00:09:45.220
all face the same way so they all got merged together. And then it has a lot of

00:09:45.280 --> 00:09:49.880
hills that made it harder to build especially in early days and it would

00:09:49.920 --> 00:09:54.819
really predated America's obsession with grids. Charlotte is kind of the opposite

00:09:54.820 --> 00:09:57.880
it's late 20th century, the sort of winding streets

00:09:57.940 --> 00:10:01.980
and cul-de-sacs to make up those arterial roads

00:10:02.060 --> 00:10:04.460
and then these sort of secluded in the center

00:10:04.660 --> 00:10:06.880
super blocks of subdivisions.

00:10:07.180 --> 00:10:09.320
- Nice, well I'm happy to see that Portland, where I live,

00:10:09.460 --> 00:10:11.920
is like a perfect propeller blade shape.

00:10:12.200 --> 00:10:15.940
You know, in our town, you have northeast, northwest,

00:10:16.260 --> 00:10:17.440
southeast, and then street numbers,

00:10:17.760 --> 00:10:20.700
like northeast 120th street, right?

00:10:20.840 --> 00:10:24.099
And it just screams we're on a perpendicular

00:10:24.100 --> 00:10:26.860
North Southeast West grid and it definitely shows up here.

00:10:27.160 --> 00:10:30.720
And so this is some of the stuff that you came up with OSM NX.

00:10:31.240 --> 00:10:35.180
- Yeah, so I used OSM NX to build all of these

00:10:35.560 --> 00:10:38.520
street network models from OpenStreetMap data.

00:10:38.940 --> 00:10:43.380
And then OSM NX has built into it a visualization module

00:10:43.620 --> 00:10:45.760
that creates these kind of polar histograms

00:10:45.760 --> 00:10:47.740
to understand how streets are oriented.

00:10:48.080 --> 00:10:49.720
- Awesome, it's super interesting.

00:10:49.820 --> 00:10:54.080
Let's, it's like it communicates to you just immediately

00:10:54.080 --> 00:10:55.060
as you look at it, it's great.

00:10:55.480 --> 00:10:58.440
Let's start by talking about OpenStreetMap.

00:10:58.500 --> 00:11:01.260
This is the backing data, obviously,

00:11:01.420 --> 00:11:03.700
the important backing data of your library.

00:11:03.880 --> 00:11:06.140
So what's the origin of OpenStreetMap?

00:11:07.180 --> 00:11:11.380
- Yeah, so OpenStreetMap started maybe 20 years ago or so.

00:11:12.020 --> 00:11:13.380
For folks who haven't seen it before,

00:11:14.240 --> 00:11:15.700
I often describe it as being akin

00:11:16.000 --> 00:11:17.620
to Google Maps meets Wikipedia.

00:11:18.240 --> 00:11:23.200
So it's a worldwide mapping project with global coverage.

00:11:23.820 --> 00:11:26.420
Anyone can edit or contribute to it.

00:11:26.740 --> 00:11:31.880
There is some editorial oversight as well to validate those edits.

00:11:32.240 --> 00:11:36.960
But what's cool about OpenStreetMap is that its data license allows you to

00:11:37.360 --> 00:11:38.820
pull data from it.

00:11:39.200 --> 00:11:44.520
So unlike, say, Google Maps, which is fairly limited in what all it can draw,

00:11:45.000 --> 00:11:48.600
you can really pull all of these features from OpenStreetMap.

00:11:48.700 --> 00:11:51.380
And if you look, if you just zoom in on one of these cities here.

00:11:51.660 --> 00:11:53.040
>> Yeah, let's go to Riverside, yeah.

00:11:53.540 --> 00:11:56.060
- Yeah, it was surface streets, rail lines,

00:11:56.560 --> 00:11:59.180
building footprints, parks, train stations,

00:11:59.380 --> 00:12:02.480
often grocery stores, restaurants, public schools.

00:12:02.840 --> 00:12:04.760
All this stuff we're interested in

00:12:04.880 --> 00:12:06.640
from an urban planning perspective.

00:12:06.980 --> 00:12:09.080
- Yeah, oh, it's really interesting.

00:12:09.240 --> 00:12:11.340
And you can add in additional layers,

00:12:11.860 --> 00:12:14.980
like cycling maps or transportation maps

00:12:15.220 --> 00:12:18.120
or topology maps, topological maps,

00:12:18.260 --> 00:12:19.760
all sorts of interesting things here.

00:12:20.140 --> 00:12:21.040
- Yeah, exactly.

00:12:21.300 --> 00:12:24.600
And it really lets you kind of hone in

00:12:24.940 --> 00:12:27.800
on the specific characteristics of the city

00:12:27.900 --> 00:12:29.220
that you're interested in.

00:12:29.820 --> 00:12:32.820
And there's a humanitarian layer that you can see,

00:12:32.840 --> 00:12:35.480
and this has been one of the big uses of OpenStreetMap

00:12:35.860 --> 00:12:38.780
now for 15 years or so.

00:12:40.000 --> 00:12:45.080
Often when there is a disaster in a less developed country,

00:12:45.540 --> 00:12:48.160
humanitarian aid organizations will go in

00:12:48.280 --> 00:12:50.779
and use OpenStreetMap and contribute to it

00:12:50.780 --> 00:12:53.520
to create a kind of a digital layer

00:12:53.660 --> 00:12:54.980
of the facts on the ground.

00:12:55.160 --> 00:12:57.700
So the Haiti earthquake a few years back

00:12:57.760 --> 00:12:59.620
was a primary example of that,

00:13:00.040 --> 00:13:03.300
where it helped them understand where urbanization was,

00:13:03.780 --> 00:13:06.300
where there were water pumps, toilets, and so forth,

00:13:06.320 --> 00:13:07.820
the kind of things that people need,

00:13:08.200 --> 00:13:11.680
but aren't well mapped, often in these informal settlements.

00:13:12.060 --> 00:13:13.520
- Yeah, oh, it's amazing.

00:13:13.740 --> 00:13:16.520
We have, you know, I think everyone was amazed

00:13:16.940 --> 00:13:19.000
when Google Maps came out, right?

00:13:19.140 --> 00:13:21.520
Before then we had MapQuest and all those things.

00:13:21.640 --> 00:13:23.740
You'd have big little up arrow, up arrow, right arrow

00:13:23.860 --> 00:13:26.020
to like pull in tiles of the world and you know,

00:13:26.500 --> 00:13:28.720
Google Maps and the world view that they had.

00:13:28.760 --> 00:13:29.720
What was that product called?

00:13:30.020 --> 00:13:30.280
Remember?

00:13:31.080 --> 00:13:32.980
Where you could kind of fly, it was like a 3D thing.

00:13:33.040 --> 00:13:34.920
You could kind of fly around in the early days

00:13:35.000 --> 00:13:36.520
but it was the same basic data thing.

00:13:36.880 --> 00:13:38.340
Anyway, when that stuff came out, it was like,

00:13:38.560 --> 00:13:40.740
wow, this stuff is, you can now know about the world.

00:13:40.800 --> 00:13:42.360
You can say, where did that road go?

00:13:42.420 --> 00:13:43.040
I never went down.

00:13:43.140 --> 00:13:44.680
You could just follow it and see

00:13:44.780 --> 00:13:45.960
or go to street view or whatever.

00:13:46.140 --> 00:13:47.960
But a lot of that is locked behind.

00:13:48.540 --> 00:13:51.400
however Google wants you to use it, right?

00:13:51.580 --> 00:13:53.300
And it's not super accessible.

00:13:53.720 --> 00:13:55.280
And so having something like this,

00:13:55.660 --> 00:13:56.740
where people can contribute,

00:13:56.920 --> 00:13:58.520
especially if they care about their neighborhood, right?

00:13:58.580 --> 00:14:00.580
A lot of this people are contributing back

00:14:00.840 --> 00:14:02.140
into OpenStreetMap data.

00:14:02.900 --> 00:14:03.640
- Yeah, exactly.

00:14:05.060 --> 00:14:06.580
Yeah, so the nice thing with this is that

00:14:07.040 --> 00:14:09.260
it really is much more in that open source,

00:14:09.540 --> 00:14:11.260
open data model of the world,

00:14:11.340 --> 00:14:13.500
which means we can do open science with it,

00:14:13.840 --> 00:14:14.960
citizen science with it.

00:14:15.280 --> 00:14:17.979
People who just notice that stuff is missing

00:14:17.980 --> 00:14:20.040
in their own community, you're able to fix it.

00:14:20.080 --> 00:14:21.660
It's no longer that frustration of,

00:14:21.980 --> 00:14:24.040
well, when will Google get this thing right?

00:14:24.100 --> 00:14:25.820
Or, hey, we have this new highway

00:14:25.980 --> 00:14:27.280
that was built outside my town.

00:14:27.640 --> 00:14:28.440
When's it gonna show up?

00:14:28.720 --> 00:14:29.340
I mean, it's up to you.

00:14:29.520 --> 00:14:31.000
You can make it show up later today.

00:14:31.320 --> 00:14:32.820
There is a drawback to that though.

00:14:33.080 --> 00:14:35.800
The drawback is you get what we call sampling biases.

00:14:36.420 --> 00:14:38.320
That is, you tend to see more coverage

00:14:38.700 --> 00:14:41.900
in places where people tend to contribute more.

00:14:42.240 --> 00:14:43.420
And those things tend to be correlated

00:14:43.560 --> 00:14:45.620
with demographic characteristics.

00:14:46.040 --> 00:14:47.300
Men contribute more than women.

00:14:47.900 --> 00:14:50.800
higher income places more than lower income places

00:14:51.340 --> 00:14:53.460
just from a resourcing perspective.

00:14:53.980 --> 00:14:55.840
And so one of the challenges we face as researchers

00:14:56.160 --> 00:15:00.340
using OpenStreetMap data for our analytics work

00:15:00.660 --> 00:15:02.000
is keeping those in mind

00:15:02.220 --> 00:15:03.820
because it's hard to do comparative analysis.

00:15:04.520 --> 00:15:06.240
If you don't know it's because the infrastructure

00:15:06.360 --> 00:15:07.620
is actually different in two places

00:15:08.100 --> 00:15:10.540
or because it's been digitized to a different extent

00:15:10.800 --> 00:15:11.420
in two places.

00:15:11.640 --> 00:15:12.580
- Right, right, right.

00:15:12.760 --> 00:15:15.379
Just maybe higher fidelity information

00:15:15.380 --> 00:15:17.880
might skew some analysis one way or another, right?

00:15:18.220 --> 00:15:19.120
- That's right, exactly.

00:15:19.380 --> 00:15:21.340
And it tends to work pretty well comparatively

00:15:21.500 --> 00:15:23.260
for stuff like roads, streets,

00:15:24.360 --> 00:15:26.920
whereas things like pedestrian footpaths

00:15:27.080 --> 00:15:30.420
or fresh food markets might be well digitized

00:15:30.440 --> 00:15:31.620
in San Francisco and Portland,

00:15:32.140 --> 00:15:35.120
but probably not, say, in a small town in India

00:15:35.360 --> 00:15:38.240
or Indonesia, let alone like a suburb of Des Moines, Iowa.

00:15:38.700 --> 00:15:39.740
- Yeah, yeah, absolutely.

00:15:40.080 --> 00:15:42.960
One of the apps that I use a lot is OnX.

00:15:43.420 --> 00:15:44.220
You know OnX?

00:15:44.760 --> 00:15:46.640
- Yeah, OnX is cool.

00:15:46.760 --> 00:15:49.000
You can, I do a lot of off-road motorcycle riding

00:15:49.300 --> 00:15:52.160
and it'll show you all the little trails and stuff,

00:15:52.360 --> 00:15:55.100
but someone's got to go and enter all that information.

00:15:55.300 --> 00:15:58.320
And so some places are super well mapped

00:15:58.400 --> 00:16:00.660
and others are not on the map at all.

00:16:00.780 --> 00:16:03.180
But I imagine they probably get some of their data

00:16:03.280 --> 00:16:04.500
from OpenStreetMap as well,

00:16:04.600 --> 00:16:05.600
although I haven't been able to tell.

00:16:06.000 --> 00:16:06.680
- Yeah, it's a good question.

00:16:06.760 --> 00:16:10.740
A lot of people downstream do use OpenStreetMap data

00:16:10.820 --> 00:16:12.600
because of its quality and accessibility.

00:16:13.220 --> 00:16:15.020
- Yeah, Mark out in the audience is asking,

00:16:15.720 --> 00:16:18.260
is there some kind of mobile app that kind of gives you

00:16:18.800 --> 00:16:20.960
access to the OpenStreetMap data?

00:16:21.260 --> 00:16:21.880
Kind of like Google Maps.

00:16:21.900 --> 00:16:25.320
- Yeah, there are some mobile apps for it.

00:16:26.820 --> 00:16:27.880
I don't use them.

00:16:27.920 --> 00:16:29.300
It has some challenges with routing

00:16:29.560 --> 00:16:31.640
because it is publicly editable.

00:16:32.180 --> 00:16:34.300
Sometimes there'll be little breaks in the connections

00:16:34.360 --> 00:16:36.260
where it's not digitized quite right.

00:16:37.120 --> 00:16:38.760
But there are routing apps.

00:16:38.780 --> 00:16:40.800
You could replace, say, Google Maps on your phone

00:16:40.880 --> 00:16:42.680
with OpenStreetMap and you can route with it.

00:16:42.940 --> 00:16:44.940
It works particularly well in big cities

00:16:45.100 --> 00:16:46.660
and places like Europe and the US,

00:16:47.180 --> 00:16:51.300
less so in small rural areas or in less developed countries.

00:16:51.600 --> 00:16:53.240
- Yeah, yeah, the onX thing is,

00:16:53.560 --> 00:16:54.540
it doesn't really route you,

00:16:54.920 --> 00:16:56.000
but it shows you on a map

00:16:56.040 --> 00:16:57.380
and then it shows you where you go on it,

00:16:57.420 --> 00:16:59.520
and if you choose to stay on the path,

00:16:59.540 --> 00:17:00.340
then it'll really help you,

00:17:00.420 --> 00:17:02.420
but it doesn't really say,

00:17:02.460 --> 00:17:05.280
you can't say, "Give me directions."

00:17:05.280 --> 00:17:07.640
At least not when you're off-road.

00:17:07.720 --> 00:17:09.300
If you're on-road, maybe it'll fall back

00:17:09.360 --> 00:17:11.120
to something that works, but yeah, amazing.

00:17:11.500 --> 00:17:14.380
- So what's the licensing story behind all this data?

00:17:14.600 --> 00:17:16.980
How, the name probably gives a lot of it away,

00:17:17.140 --> 00:17:19.780
OpenStreetMap, but how is this data usable?

00:17:19.959 --> 00:17:20.740
What can people do with it?

00:17:20.939 --> 00:17:22.640
- Yeah, so it's basically usable

00:17:23.839 --> 00:17:26.400
for non-commercial purposes with attribution.

00:17:26.680 --> 00:17:29.320
So for example, as researchers,

00:17:29.600 --> 00:17:32.240
when we are using these data,

00:17:32.340 --> 00:17:34.980
we just need to attribute where it came from,

00:17:35.060 --> 00:17:37.040
OpenStreetMap and its contributors.

00:17:38.260 --> 00:17:41.600
And I ended up including that license information

00:17:41.760 --> 00:17:44.640
somewhere on the read me for OSMNX,

00:17:45.120 --> 00:17:47.660
because I think a lot of time people will look over

00:17:48.060 --> 00:17:50.520
these underlying data sources and tools

00:17:50.960 --> 00:17:53.440
when they're using these kind of downstream,

00:17:53.600 --> 00:17:56.000
downstream tools and apps.

00:17:56.440 --> 00:17:58.800
So because of that, I just wanted to call it,

00:17:58.840 --> 00:18:00.020
yeah, you can see it on screen here.

00:18:00.100 --> 00:18:02.280
So I mentioned OpenStreetMaps open data license

00:18:02.420 --> 00:18:05.700
requires that derivative works provide proper attribution,

00:18:06.060 --> 00:18:08.660
which is really nice 'cause it's a very easy thing to do

00:18:08.800 --> 00:18:11.660
for the cornucopia of data that they make available.

00:18:11.740 --> 00:18:12.840
- Yeah, yeah, that's amazing.

00:18:14.620 --> 00:18:16.020
This portion of Talk Python To Me

00:18:16.080 --> 00:18:17.540
is brought to you by the folks at Posit.

00:18:18.000 --> 00:18:19.580
Posit has made a huge investment

00:18:19.700 --> 00:18:20.880
in the Python community lately.

00:18:21.580 --> 00:18:22.880
Known originally for RStudio,

00:18:23.320 --> 00:18:25.120
they've been building out a suite of tools

00:18:25.260 --> 00:18:26.680
and services for Team Python.

00:18:27.440 --> 00:18:28.400
Over the past few years,

00:18:28.600 --> 00:18:30.740
we've all learned some pretty scary terms,

00:18:31.220 --> 00:18:37.860
of squatting, supply chain attack, obfuscated code, and more. These all orbit around the idea

00:18:38.120 --> 00:18:42.880
that when you install Python packages, you're effectively running arbitrary code off the

00:18:43.100 --> 00:18:48.420
internet on your dev machine, and usually even on your servers. The thought alone makes me shudder,

00:18:48.840 --> 00:18:52.700
and this doesn't even touch the reproducibility issues surrounding external packages.

00:18:53.420 --> 00:18:58.100
But there are tools to help. Posit Package Manager can solve both problems for you.

00:18:58.740 --> 00:19:02.200
Think of Posit Package Manager as your personal package concierge.

00:19:02.520 --> 00:19:07.040
You use it to build your own package repositories within your firewall that keep your project safe.

00:19:07.240 --> 00:19:12.160
You can upload your own internal packages to share or import packages directly from PyPI.

00:19:12.900 --> 00:19:18.300
Your team members can install from these repos in normal ways using tools like pip, poetry, and uv.

00:19:18.860 --> 00:19:22.760
Posit Package Manager can help you manage updates ensuring you're using the latest,

00:19:23.360 --> 00:19:28.720
most secure versions of your packages. But it also takes point-in-time snapshots of your

00:19:28.720 --> 00:19:33.060
repos, which you can use to rerun your code reproducibly in the future.

00:19:33.580 --> 00:19:37.720
Posit Package Manager reports on packages with known CVEs and other vulnerabilities

00:19:38.120 --> 00:19:39.680
so you can keep ahead of threats.

00:19:40.260 --> 00:19:44.620
And if you need the highest level of security, you can even run Posit Package Manager in

00:19:44.760 --> 00:19:45.720
air-gapped environments.

00:19:46.140 --> 00:19:50.100
If you work on our data science team where security matters, you owe it to you and your

00:19:50.440 --> 00:19:52.260
org to check out Posit Package Manager.

00:19:52.800 --> 00:19:56.000
visit talkpython.fm/ppm today

00:19:56.360 --> 00:19:58.620
and get a three month free trial to see if it's a good fit.

00:19:58.760 --> 00:20:01.100
That's talkpython.fm/ppm.

00:20:01.660 --> 00:20:03.380
The link is in your podcast player show notes.

00:20:03.820 --> 00:20:05.340
Thank you to Posit for supporting the show.

00:20:07.200 --> 00:20:09.760
If I wanted to build a commercial product,

00:20:10.100 --> 00:20:12.220
I wanted to build on X squared or whatever,

00:20:12.300 --> 00:20:14.340
where I could have people drive around and use that

00:20:14.620 --> 00:20:17.000
and map it and make notes and maybe contribute back.

00:20:17.580 --> 00:20:18.340
Do you know what the story,

00:20:18.460 --> 00:20:20.300
I mean, obviously not a lawyer, right?

00:20:20.460 --> 00:20:23.660
But what's the, would people be able to do that?

00:20:23.700 --> 00:20:25.940
Or is there a paid API or how does it work?

00:20:25.960 --> 00:20:26.940
- It's a good question.

00:20:27.060 --> 00:20:29.140
So I know in practice people can

00:20:29.320 --> 00:20:30.700
because I see commercial tools

00:20:30.720 --> 00:20:32.380
that use OpenStreetMap data all the time.

00:20:32.940 --> 00:20:34.120
I don't know the details though

00:20:34.220 --> 00:20:36.020
because one of the nice things about being in academia

00:20:36.700 --> 00:20:39.280
is you end up being so divorced from the commercial world

00:20:39.400 --> 00:20:40.980
that I don't have to worry about that.

00:20:41.340 --> 00:20:44.400
- Yeah, that's pretty good, right?

00:20:44.460 --> 00:20:47.100
Just do your research, answer interesting questions

00:20:47.320 --> 00:20:48.540
and follow the lead, right?

00:20:48.800 --> 00:20:49.720
- Those are the benefits, yeah.

00:20:49.940 --> 00:20:51.460
It comes with drawbacks, but those are the benefits.

00:20:52.840 --> 00:20:54.320
- Yeah, I'm aware of some of the drawbacks as well,

00:20:54.500 --> 00:20:54.740
for sure.

00:20:55.720 --> 00:20:58.620
All right, well, so that is the foundation

00:20:59.160 --> 00:21:00.960
of this project, OSMNX.

00:21:01.420 --> 00:21:02.360
Tell us about your project.

00:21:03.200 --> 00:21:06.760
- Yeah, so OSMNX is a Python package

00:21:07.420 --> 00:21:10.400
that lets you interact with OpenShift's APIs

00:21:10.540 --> 00:21:12.360
to make it really easy to download data

00:21:12.760 --> 00:21:17.460
and build models or a data frame of those data.

00:21:17.580 --> 00:21:22.820
So the two main things that it does is it can create a graph model.

00:21:22.900 --> 00:21:29.440
So that is a model of a network like streets or rails or highways or anything else.

00:21:30.180 --> 00:21:31.820
Or you can create a geo data frame.

00:21:31.900 --> 00:21:37.760
That's kind of a spatialized version of a pandas data frame using GeoPandas of OpenStreetMap features.

00:21:38.320 --> 00:21:40.440
So that's all the stuff in OpenStreetMap.

00:21:40.480 --> 00:21:43.140
It could be points, lines, polygons.

00:21:43.260 --> 00:21:47.880
It could be traffic signals or parks or schools or roads.

00:21:48.800 --> 00:21:50.340
But you can download either of those

00:21:50.540 --> 00:21:53.360
and then do whatever it is you wanna do with them.

00:21:53.420 --> 00:21:56.460
And OSMNX has some other stuff built in.

00:21:56.540 --> 00:21:59.180
So it has a simple routing engine built in,

00:21:59.860 --> 00:22:02.260
some visualization tools.

00:22:02.720 --> 00:22:03.800
You can work with elevation

00:22:04.220 --> 00:22:06.980
so that you can figure out street grades.

00:22:07.760 --> 00:22:10.160
Particularly relevant, for example, if you're a cyclist

00:22:10.500 --> 00:22:12.200
and you're trying to choose a shortest path

00:22:12.200 --> 00:22:14.800
that maybe minimizes those grades and so forth.

00:22:15.300 --> 00:22:18.880
- Even for cars, Google started offering a,

00:22:19.320 --> 00:22:22.120
this path saves, uses the least fuel,

00:22:22.360 --> 00:22:24.140
or in my case, the least electricity,

00:22:24.840 --> 00:22:27.380
whatever you put into it to make it go.

00:22:28.240 --> 00:22:31.100
That's also, uses like that would be interesting.

00:22:32.020 --> 00:22:32.760
- Yeah, exactly.

00:22:33.120 --> 00:22:34.640
I mean, kind of superficially,

00:22:34.760 --> 00:22:37.600
we always imagine that our shortest path to get somewhere

00:22:37.700 --> 00:22:39.480
is the one that minimizes our travel time.

00:22:39.840 --> 00:22:42.180
But in reality, there are a lot of other things

00:22:42.180 --> 00:22:44.760
minimize including fuel consumption or for pedestrians.

00:22:45.940 --> 00:22:48.040
Empirically, we know that people will take

00:22:48.340 --> 00:22:50.160
longer routes if it's a nicer route.

00:22:50.320 --> 00:22:52.840
We're not trying to shave off a minute to walk along

00:22:52.920 --> 00:22:55.380
the arterial road with the aluminum.

00:22:55.600 --> 00:22:58.960
>> You go through the fence

00:22:59.060 --> 00:23:00.900
by that old abandoned factory back here,

00:23:00.960 --> 00:23:02.980
and you go straight across, it'll be great.

00:23:03.040 --> 00:23:03.680
You'll save a minute.

00:23:05.880 --> 00:23:06.380
>> Exactly.

00:23:07.000 --> 00:23:09.300
>> Amazing. Okay. Yeah, super fun.

00:23:09.460 --> 00:23:10.700
As part of those visualizations,

00:23:11.020 --> 00:23:12.400
Can you draw maps?

00:23:13.480 --> 00:23:17.080
You can, yeah. So it has some mapping capabilities.

00:23:17.940 --> 00:23:19.620
You can also plot routes on it.

00:23:20.280 --> 00:23:23.960
It ties into a folium package,

00:23:24.360 --> 00:23:28.440
which is a Python package to develop leaflet JavaScript web maps.

00:23:28.900 --> 00:23:30.720
So you can do interactive web maps from it.

00:23:31.060 --> 00:23:36.960
And then on top of OSMNX, there's a cool downstream package

00:23:37.160 --> 00:23:39.580
called Pretty Maps that I'm not affiliated with,

00:23:39.580 --> 00:23:43.760
but does really nice, aesthetically pleasing mapping.

00:23:44.140 --> 00:23:45.980
It's really customizable and really cool.

00:23:46.740 --> 00:23:48.440
>> Okay. Do you have a gallery or something?

00:23:48.840 --> 00:23:50.940
>> I do. Yeah. So if you scroll up a little bit,

00:23:51.040 --> 00:23:53.200
there's a link to the examples gallery.

00:23:53.480 --> 00:23:57.120
It's on GitHub, OSMNX examples.

00:23:57.500 --> 00:23:59.100
>> You can pull up different notebooks?

00:23:59.620 --> 00:24:03.540
>> Yeah, exactly. So each notebook covers a different theme of analysis.

00:24:03.740 --> 00:24:05.980
It would be commonly done with OSMNX.

00:24:06.340 --> 00:24:07.540
>> Oh, nice. Yeah, that's really cool.

00:24:07.600 --> 00:24:09.200
People just pull up the notebook and see how it works.

00:24:09.260 --> 00:24:11.140
What one do you think is a good representative one

00:24:11.140 --> 00:24:12.840
to maybe like get a sense of how to work with it?

00:24:13.020 --> 00:24:14.940
- So we count from zero

00:24:15.200 --> 00:24:16.120
'cause we're in the Python world.

00:24:16.260 --> 00:24:19.260
So notebook zero zero is a good place to start.

00:24:19.600 --> 00:24:22.640
That kind of steps through some of the basic functionality

00:24:22.760 --> 00:24:26.620
that most users would be interested in starting with.

00:24:26.860 --> 00:24:27.640
- Sure, okay.

00:24:28.040 --> 00:24:29.700
Yeah, so people can download these notebooks

00:24:30.140 --> 00:24:33.400
in the examples repository, which I'll link to.

00:24:34.000 --> 00:24:34.640
- Yeah, exactly.

00:24:34.760 --> 00:24:38.700
So there's a getting started guide in the documentation

00:24:38.700 --> 00:24:40.080
after kind of reading through that,

00:24:40.820 --> 00:24:42.820
that examples gallery is a really good way

00:24:42.920 --> 00:24:44.640
to just kind of get a sense of code

00:24:44.700 --> 00:24:46.320
that you can copy and paste to get started.

00:24:46.560 --> 00:24:47.360
- Okay, excellent.

00:24:47.700 --> 00:24:50.760
And 5,000 GitHub stars, almost a thousand forks.

00:24:51.120 --> 00:24:52.540
You know, that's quite a bit of traction.

00:24:52.800 --> 00:24:53.240
Congratulations.

00:24:53.840 --> 00:24:54.760
- Yeah, thanks.

00:24:54.820 --> 00:24:55.540
I mean, it's weird.

00:24:55.620 --> 00:24:57.700
This is very much my side hustle,

00:24:57.780 --> 00:25:00.040
but it's also really been a labor of love

00:25:00.140 --> 00:25:02.060
for a long time now.

00:25:02.520 --> 00:25:04.860
There is no reward in academia

00:25:05.180 --> 00:25:07.540
for creating open source packages.

00:25:08.140 --> 00:25:09.720
I think if you explain it very carefully

00:25:10.140 --> 00:25:12.700
to academic power brokers, they say,

00:25:13.140 --> 00:25:15.800
"That makes sense, that's great, that's a good contribution."

00:25:15.800 --> 00:25:18.140
But prima facie, that doesn't mean anything.

00:25:18.480 --> 00:25:19.020
They have no idea.

00:25:19.040 --> 00:25:20.900
- It's really, it's tough to put it

00:25:20.940 --> 00:25:22.580
on a 10-year application, right?

00:25:22.920 --> 00:25:25.940
- Yeah, it makes it sound like you're wasting your time

00:25:25.960 --> 00:25:27.900
and you don't understand what you're supposed to be doing

00:25:27.980 --> 00:25:28.860
with your time.

00:25:29.320 --> 00:25:29.540
(laughing)

00:25:29.540 --> 00:25:32.480
- Like, but you understand, the research is so easy now.

00:25:32.800 --> 00:25:33.120
- Yeah.

00:25:33.420 --> 00:25:34.860
I mean, that's really how that started.

00:25:34.980 --> 00:25:37.420
I thought I was gonna be able to do this research

00:25:37.420 --> 00:25:39.820
without having to create my own tool,

00:25:39.920 --> 00:25:41.400
but it turned out I was not able to.

00:25:41.620 --> 00:25:42.560
- Interesting, what was your background

00:25:42.680 --> 00:25:43.560
in programming at that point?

00:25:45.240 --> 00:25:48.960
- Yeah, so my undergrad and master's degree,

00:25:49.540 --> 00:25:52.580
I did computer systems and information systems.

00:25:53.420 --> 00:25:56.000
I worked in the private sector for a few years

00:25:56.080 --> 00:25:56.900
and decided to go back to school

00:25:56.980 --> 00:25:58.940
for my PhD in urban planning.

00:25:59.300 --> 00:26:00.340
But when I was coming into that,

00:26:00.360 --> 00:26:03.380
I was pitching myself as this sort of like

00:26:03.380 --> 00:26:07.160
data science analytics kind of person in that world,

00:26:07.620 --> 00:26:09.620
which was starting to get kind of hot at that time.

00:26:09.720 --> 00:26:11.580
So it ended up being a nice fit.

00:26:12.380 --> 00:26:14.720
And when I started my dissertation,

00:26:14.840 --> 00:26:18.300
I had this dissertation proposal that was, you know,

00:26:19.040 --> 00:26:21.440
very, very nice, this kind of big grand proposal.

00:26:21.940 --> 00:26:23.800
I ended up only doing the first chapter of it

00:26:23.820 --> 00:26:24.980
for my entire dissertation

00:26:25.260 --> 00:26:27.200
because of how these things expand to fill space.

00:26:27.800 --> 00:26:30.860
And when I pitched my proposal to my dissertation committee,

00:26:31.780 --> 00:26:33.320
there are a lot of assumptions about the tools

00:26:33.360 --> 00:26:33.880
that were out there.

00:26:33.980 --> 00:26:35.460
You know, I knew OpenStreetMap was out there.

00:26:35.840 --> 00:26:37.300
I'd seen there were some tools to download

00:26:37.360 --> 00:26:38.240
and work with data from it.

00:26:38.300 --> 00:26:40.620
So I was pretty sure we'd be able to create

00:26:40.740 --> 00:26:43.120
a nice mathematical graph model

00:26:43.480 --> 00:26:45.200
of OpenStreetMap data automatically.

00:26:46.160 --> 00:26:49.420
As I started on my first week of making that happen,

00:26:49.480 --> 00:26:51.000
I realized the tool did not exist.

00:26:51.720 --> 00:26:53.960
And in fact, it was profoundly difficult

00:26:54.140 --> 00:26:56.120
to get data from OpenStreetMap.

00:26:56.580 --> 00:26:57.680
If you wanted to filter it,

00:26:57.800 --> 00:27:00.320
like I just want pedestrian paths, not everything.

00:27:01.100 --> 00:27:04.300
I just want drivable streets, not everything else.

00:27:04.640 --> 00:27:06.600
And so the first year of my dissertation work

00:27:06.640 --> 00:27:10.920
was creating the first version of OSM and X accordingly.

00:27:11.080 --> 00:27:15.080
- So you must have grants and stuff for your research

00:27:15.140 --> 00:27:16.540
as academics do.

00:27:17.080 --> 00:27:20.740
How much time are you allowed to sort of bring some of that

00:27:20.760 --> 00:27:23.360
into adding features back to this project?

00:27:24.480 --> 00:27:27.000
- Yeah, back to the benefits of academia,

00:27:27.440 --> 00:27:29.299
the nice thing is as long as you get

00:27:29.300 --> 00:27:30.960
what they want to see done,

00:27:31.060 --> 00:27:32.280
as long as those outputs are there,

00:27:32.780 --> 00:27:34.660
your time is really completely your own, right?

00:27:34.760 --> 00:27:35.800
So you teach a couple classes,

00:27:36.140 --> 00:27:37.480
you have to publish a few papers a year.

00:27:37.660 --> 00:27:39.300
Other than that, you're free to do whatever.

00:27:39.560 --> 00:27:43.080
So I do get grants, helps me fund my graduate students.

00:27:44.020 --> 00:27:46.880
Ironically, it's very hard to get grants

00:27:46.940 --> 00:27:49.700
to do this kind of open source software,

00:27:49.880 --> 00:27:51.560
open commons development.

00:27:52.040 --> 00:27:53.100
Everyone talks about it,

00:27:53.200 --> 00:27:54.580
and especially grant funders know

00:27:54.700 --> 00:27:56.280
how much we all use this stuff,

00:27:56.580 --> 00:27:57.760
and they really like it,

00:27:57.840 --> 00:27:59.460
but it just doesn't get funded.

00:27:59.640 --> 00:28:02.880
So what you have to do is you have to kind of hack it in

00:28:03.120 --> 00:28:05.920
or sideload it, I guess, into your grants

00:28:06.020 --> 00:28:08.380
where the grant will answer this empirical question

00:28:08.460 --> 00:28:10.080
that's near and dear to the funder's heart.

00:28:10.400 --> 00:28:12.600
But to do that, we have this tool building phase

00:28:12.720 --> 00:28:16.920
for six months, be able to unlock the analytics for it.

00:28:16.980 --> 00:28:19.500
And so that's really how a lot of the features

00:28:19.560 --> 00:28:23.180
and a lot of the modules have been added to OSMNx over time.

00:28:23.520 --> 00:28:24.820
There's this new project I ought to do,

00:28:25.320 --> 00:28:26.960
so we'll just build it into the package.

00:28:27.320 --> 00:28:29.840
- Right, we need to be able to answer new questions,

00:28:30.000 --> 00:28:32.680
so we gotta have new ways to get to the data, yeah?

00:28:32.980 --> 00:28:33.940
- Yeah, exactly.

00:28:34.380 --> 00:28:38.260
And it is poorly incentivized in academia,

00:28:38.420 --> 00:28:39.760
but academia has really been home

00:28:39.840 --> 00:28:42.580
to a lot of open source tool development,

00:28:42.740 --> 00:28:44.180
especially niche tools, you know,

00:28:44.300 --> 00:28:46.300
from stuff like Astropy,

00:28:47.340 --> 00:28:49.280
for the astronomers and astrophysicists,

00:28:49.420 --> 00:28:51.080
to things like PySAL,

00:28:51.160 --> 00:28:53.040
the Spatial Analysis Library in Python,

00:28:53.520 --> 00:28:54.600
but a lot of things that academics

00:28:54.700 --> 00:28:56.140
have kind of been at the forefront of,

00:28:56.300 --> 00:28:57.920
But for us, it's always a side hustle.

00:28:58.340 --> 00:29:00.180
- Right, stuff with biology, psychology,

00:29:00.420 --> 00:29:02.020
a lot of the sciences, I imagine.

00:29:02.320 --> 00:29:02.820
- Yeah, yeah.

00:29:02.980 --> 00:29:05.560
- Working on open source projects like this

00:29:05.800 --> 00:29:08.520
feels to me very much like the concept

00:29:08.640 --> 00:29:11.240
of funding basic science, right?

00:29:11.300 --> 00:29:13.540
Not funding, we need to solve this problem

00:29:13.680 --> 00:29:17.300
so we can create a bomb or new energy or go to space,

00:29:17.400 --> 00:29:18.080
but we're just doing it

00:29:18.240 --> 00:29:20.480
'cause we need to understand the science better

00:29:20.720 --> 00:29:23.100
and it'll help us then apply it eventually,

00:29:23.380 --> 00:29:24.660
maybe, at some point, right?

00:29:24.720 --> 00:29:25.580
Same sort of thing here.

00:29:26.100 --> 00:29:31.100
If these exist, it will supercharge the urban planning space

00:29:31.520 --> 00:29:34.100
to a huge degree, but getting people to fund it

00:29:34.140 --> 00:29:36.580
or to care about helping build that up,

00:29:37.140 --> 00:29:39.040
I imagine it's a little bit frustrating.

00:29:39.560 --> 00:29:42.620
- No, that's exactly, I mean, the way I talk about it

00:29:42.680 --> 00:29:44.900
is it really is a sort of basic science work

00:29:44.980 --> 00:29:46.260
that everyone takes for granted

00:29:46.620 --> 00:29:49.120
as though these things just exist, right?

00:29:49.520 --> 00:29:52.300
This tool just exists, we don't know where it comes from,

00:29:52.620 --> 00:29:54.960
it has an API, that API just exists,

00:29:55.620 --> 00:29:59.380
And it really kind of obscures all of these human decisions

00:29:59.620 --> 00:30:03.080
and social structures and processes and institutions

00:30:03.420 --> 00:30:06.380
that make it difficult or make other things easy

00:30:06.540 --> 00:30:09.540
and really shape what we end up being able to work with.

00:30:09.720 --> 00:30:10.620
- Yeah, absolutely.

00:30:11.040 --> 00:30:13.580
Well, someday maybe you can put down,

00:30:13.940 --> 00:30:15.820
yeah, I only wrote two papers,

00:30:15.920 --> 00:30:17.840
but I have 10,000 get up stars, so.

00:30:18.120 --> 00:30:18.880
- Yeah, well.

00:30:19.640 --> 00:30:21.620
- Here's your tenure assignment, you know.

00:30:22.300 --> 00:30:25.100
This is the future, I'm there for it.

00:30:26.599 --> 00:30:29.080
- It's a race between whether ChatGPT overtakes

00:30:29.340 --> 00:30:31.480
all of that stuff or you get there and people,

00:30:31.800 --> 00:30:33.240
I don't know, that's a whole different deal.

00:30:33.280 --> 00:30:34.000
We can talk about that later.

00:30:36.080 --> 00:30:38.340
Let's talk about the Overpass API though.

00:30:38.900 --> 00:30:43.040
That's the way that you get data from OpenStreetMap.

00:30:43.120 --> 00:30:43.580
What is this?

00:30:44.020 --> 00:30:52.280
- Yeah, so the Overpass API is another open source tool

00:30:52.280 --> 00:30:56.240
OpenStreetMaps database and download stuff, basically,

00:30:56.680 --> 00:30:59.440
any of OpenStreetMaps features.

00:31:00.040 --> 00:31:03.400
So what's nice about Overpass is that there's some public

00:31:03.500 --> 00:31:07.020
instances that you can just query as a web API.

00:31:07.600 --> 00:31:11.500
You can also host it locally if you want to work around

00:31:11.820 --> 00:31:13.600
throttling limits, rate limits.

00:31:15.040 --> 00:31:18.100
Challenge with the Overpass API--

00:31:18.120 --> 00:31:20.280
you can see a little bit of it here on screen-- is that the

00:31:20.280 --> 00:31:22.460
OverpassQL, it's query language,

00:31:23.460 --> 00:31:28.140
can be really hard to work with to do complex stuff.

00:31:28.200 --> 00:31:29.400
So this is a fairly simple one.

00:31:29.420 --> 00:31:31.280
On screen we can see there's a bounding box

00:31:31.640 --> 00:31:33.600
with some lat long coordinates

00:31:33.840 --> 00:31:36.400
to explain where we wanna download data from.

00:31:37.000 --> 00:31:39.300
The output will be in JSON format.

00:31:39.540 --> 00:31:41.700
The server timeout is 90 seconds.

00:31:42.220 --> 00:31:44.300
Big queries can take a long time to run.

00:31:45.220 --> 00:31:47.920
And then we're querying here for way elements.

00:31:48.240 --> 00:31:52.400
So way would be a line feature in OpenStreetMap.

00:31:53.160 --> 00:31:54.980
Any line, it could be street,

00:31:55.260 --> 00:31:59.160
it could also be the building footprints boundary line.

00:31:59.500 --> 00:32:03.580
- I see, the property lines are zoning or whatever, right?

00:32:04.240 --> 00:32:04.660
- Yeah, exactly.

00:32:04.820 --> 00:32:07.620
Anything represented as a line.

00:32:07.780 --> 00:32:11.280
And so we get that back out, it'll be kicked out as a JSON.

00:32:12.160 --> 00:32:15.800
And what OSMNx does is it works with this overpass API

00:32:15.800 --> 00:32:18.200
to try to automate some of these queries.

00:32:18.380 --> 00:32:20.020
So rather than having to write the query yourself,

00:32:20.420 --> 00:32:22.740
download the data, and then convert that raw

00:32:22.900 --> 00:32:25.380
OpenStreetMap data into a useful data format,

00:32:25.480 --> 00:32:28.720
like drop it into Geopandas or into a NetworkX graph,

00:32:29.000 --> 00:32:31.060
it assembles all of that under the hood.

00:32:31.420 --> 00:32:32.980
It's open source, it's well-documented.

00:32:33.180 --> 00:32:35.960
I have a few peer-reviewed articles about the exact process.

00:32:36.340 --> 00:32:38.120
So we don't all have to reinvent the wheel

00:32:38.220 --> 00:32:39.320
trying to work with this data

00:32:39.480 --> 00:32:40.940
because none of this is automatic.

00:32:41.100 --> 00:32:43.300
And in fact, 10 plus years ago,

00:32:43.440 --> 00:32:45.920
People were very laboriously having to write

00:32:46.060 --> 00:32:47.380
these long scripts.

00:32:47.860 --> 00:32:48.500
- You know what I'm gonna do?

00:32:48.540 --> 00:32:49.920
I'm gonna get a grad student

00:32:50.100 --> 00:32:52.120
and it's gonna be their job for the summer

00:32:52.460 --> 00:32:55.360
to convert this to Excel or MATLAB for me.

00:32:55.540 --> 00:32:56.080
Something like that.

00:32:56.100 --> 00:32:56.580
- Yeah, exactly, yeah.

00:32:57.360 --> 00:32:58.160
Grad students are great.

00:32:59.600 --> 00:33:00.980
But what's much greater, I think,

00:33:01.020 --> 00:33:02.520
is having one or two lines of code

00:33:02.640 --> 00:33:04.020
to replace your grad student for the summer.

00:33:04.060 --> 00:33:06.040
- 100%, let them do meaningful work

00:33:06.140 --> 00:33:07.280
that they also like, right?

00:33:07.620 --> 00:33:08.780
- Yeah, that's the whole--

00:33:08.800 --> 00:33:09.140
- Find it out.

00:33:09.520 --> 00:33:10.700
Yeah, yeah, that's fantastic.

00:33:10.820 --> 00:33:12.640
As I look at this and think about this,

00:33:12.680 --> 00:33:19.920
It feels to me like OSM and X is a little bit like an ORM is to SQL and databases.

00:33:20.200 --> 00:33:20.380
Right?

00:33:20.500 --> 00:33:25.900
Like, let's you, you think more in Python language and concepts and don't

00:33:26.040 --> 00:33:28.980
worry about the query syntax and the data and all that kind of stuff.

00:33:29.040 --> 00:33:31.080
Is that a reasonable analogy?

00:33:31.120 --> 00:33:32.460
>> Yeah, that's a good way to put it.

00:33:32.680 --> 00:33:37.520
And, and the goal for doing something like that is to try to democratize

00:33:37.580 --> 00:33:38.760
doing some of these analyses.

00:33:39.080 --> 00:33:41.780
You know, open street map data are really amazing.

00:33:41.860 --> 00:33:43.800
Overpass is an amazing resource,

00:33:43.900 --> 00:33:45.360
but it's really hard to work with

00:33:45.500 --> 00:33:47.660
unless you have some software development

00:33:48.080 --> 00:33:50.000
or database experience.

00:33:50.400 --> 00:33:52.640
And a lot of urban planners or urban geographers

00:33:52.880 --> 00:33:54.900
or urban sociologists do not.

00:33:55.280 --> 00:33:57.300
They have great questions, they have great theory,

00:33:57.380 --> 00:33:59.040
they want a hypothesis test, right?

00:33:59.140 --> 00:34:03.080
But we limit science if our tools are too difficult to use

00:34:03.200 --> 00:34:05.720
or the right data are too hard to access.

00:34:06.160 --> 00:34:08.820
- Yeah, back to that basic science ideas, right?

00:34:09.399 --> 00:34:09.500
- Yeah.

00:34:10.700 --> 00:34:13.940
- Yeah, so for something like this, what OSMNX does

00:34:14.120 --> 00:34:16.360
is it puts that kind of overpatch query

00:34:16.440 --> 00:34:17.580
into much more natural language.

00:34:17.700 --> 00:34:20.060
Since Python is so readable in the first place,

00:34:20.379 --> 00:34:22.919
you can just say something like graph from place,

00:34:23.340 --> 00:34:26.780
give it a city name, say Pasadena, California.

00:34:27.520 --> 00:34:31.220
My network type will be drive, and then just like that,

00:34:31.300 --> 00:34:33.899
I have that drivable street network model

00:34:34.280 --> 00:34:36.360
within the city limits of Pasadena.

00:34:36.760 --> 00:34:39.379
- Right, yeah, that sounds entirely more usable.

00:34:39.480 --> 00:34:41.260
- And one of the things you said is that it's,

00:34:42.020 --> 00:34:45.100
it can be pretty expensive to query the Overpass API,

00:34:45.419 --> 00:34:48.419
and so your library caches that stuff locally, right?

00:34:48.919 --> 00:34:52.280
- That's right, yeah, so expense in the computational sense,

00:34:52.340 --> 00:34:54.419
all these things are free to use.

00:34:55.020 --> 00:34:56.560
- That's what I mean, computationally expensive.

00:34:56.980 --> 00:34:59.320
- Yeah, exactly, and there's a lot of time complexity

00:34:59.700 --> 00:35:00.680
to it as well.

00:35:01.200 --> 00:35:04.160
So what we do is we cache everything,

00:35:04.380 --> 00:35:05.520
which helps you avoid rate limiting.

00:35:05.840 --> 00:35:07.840
let's OSMNX be a good neighbor

00:35:08.360 --> 00:35:12.680
to these free public commons resources that are out there.

00:35:12.980 --> 00:35:13.440
- Yeah, interesting.

00:35:13.720 --> 00:35:16.700
It sounds almost like you could have a Docker containers

00:35:16.820 --> 00:35:18.940
for different cities that are preloaded

00:35:19.240 --> 00:35:21.100
with all the data that might be interesting

00:35:21.220 --> 00:35:24.540
to just instantaneously answer a bunch of questions.

00:35:24.920 --> 00:35:26.360
- Yeah, which is really my work.

00:35:26.400 --> 00:35:27.800
So a lot of what I do will be,

00:35:29.020 --> 00:35:30.640
I study every street network

00:35:30.760 --> 00:35:32.980
for every urbanized area in the world, right?

00:35:33.040 --> 00:35:34.740
So we'll have like eight to 9,000

00:35:34.880 --> 00:35:37.160
of these large urban models.

00:35:38.000 --> 00:35:40.360
And so I'll just have things cached locally

00:35:40.860 --> 00:35:43.120
so that the model building and analytics

00:35:43.220 --> 00:35:44.620
are really at the forefront

00:35:44.900 --> 00:35:47.400
rather than the downloading and querying for a day.

00:35:47.760 --> 00:35:49.360
- Right, it's not only lets you be a good citizen

00:35:49.440 --> 00:35:51.960
and not hammer on OpenStreetMaps API,

00:35:52.200 --> 00:35:53.940
but it just lets your stuff work faster.

00:35:54.100 --> 00:35:56.600
So the incentives are aligned there, right?

00:35:57.260 --> 00:35:58.360
- Yeah, and in fact, a lot of the time

00:35:58.580 --> 00:36:00.580
when people first use OSMNX,

00:36:00.680 --> 00:36:04.580
you know, you'll download the, say the model of Los Angeles, California,

00:36:05.520 --> 00:36:09.260
and it takes a minute to run the query on their server, download whatever,

00:36:09.640 --> 00:36:13.820
a hundred megabytes of data, and then build that graph,

00:36:14.060 --> 00:36:18.040
theoretic model, do all the spatial stuff to it. but after that,

00:36:18.620 --> 00:36:20.140
it's nice and fast the next time that you do it,

00:36:20.240 --> 00:36:22.900
because you're able to skip all of that pre-processing from the cache.

00:36:23.120 --> 00:36:26.660
It probably puts it into some super efficient data structure.

00:36:29.040 --> 00:36:31.520
or some others, maybe dictionaries, who knows, right?

00:36:31.760 --> 00:36:35.160
- Yeah, yeah, and we use spatial indexes

00:36:35.280 --> 00:36:38.980
to accelerate all of the spatial queries locally too,

00:36:39.180 --> 00:36:39.360
as well.

00:36:40.160 --> 00:36:41.800
- Is that built into Geopandas?

00:36:42.220 --> 00:36:45.540
- Yeah, built into Geopandas, there is an R tree,

00:36:45.820 --> 00:36:48.480
which is probably the most common spatial index.

00:36:48.580 --> 00:36:54.260
But in addition to that, we also use SciPy's KD tree.

00:36:54.460 --> 00:36:57.479
They have like a C implementation of a K dimensional tree

00:36:57.480 --> 00:36:59.260
that we can do nearest neighbor search.

00:37:00.120 --> 00:37:01.600
So for example, Google Maps,

00:37:01.640 --> 00:37:03.320
you say from my origin to my destination,

00:37:03.500 --> 00:37:04.620
we can do the same kind of thing.

00:37:04.780 --> 00:37:06.460
Say from this point to that point,

00:37:06.560 --> 00:37:08.640
we'll snap the nearest neighbor on the network

00:37:08.740 --> 00:37:10.520
and then solve a path between them.

00:37:10.760 --> 00:37:13.360
- Okay, so just the k-nearest neighbor algorithm

00:37:13.560 --> 00:37:15.140
sort of applied to, what is that,

00:37:15.420 --> 00:37:18.920
the vectors of the intersections or something?

00:37:19.220 --> 00:37:20.100
Or then you--

00:37:20.160 --> 00:37:23.500
- Yeah, so normally when you do origins and destinations,

00:37:23.740 --> 00:37:25.500
you would snap to a node in the network.

00:37:25.600 --> 00:37:27.660
So the nodes would be like the intersections and dead ends.

00:37:28.020 --> 00:37:30.720
And then the edges would be the links,

00:37:30.800 --> 00:37:33.240
the street segments that connect everything together.

00:37:33.560 --> 00:37:37.300
And when you solve a path on a graph,

00:37:37.960 --> 00:37:41.080
it would be from a start node to an end node.

00:37:41.380 --> 00:37:42.740
Then you'd minimize it by something,

00:37:43.160 --> 00:37:45.640
either the fewest hops or the shortest distance

00:37:46.080 --> 00:37:47.280
or the shortest travel time.

00:37:47.340 --> 00:37:49.440
If you incorporate, say, speed limits, everything else,

00:37:49.500 --> 00:37:51.720
you can bring in congestion information

00:37:51.900 --> 00:37:54.319
to minimize traffic congested travel time

00:37:54.320 --> 00:37:57.740
or minimize going up and down hills or anything else.

00:37:58.060 --> 00:37:58.300
- Excellent.

00:37:58.600 --> 00:38:00.960
If I got this data downloaded

00:38:01.360 --> 00:38:03.960
and I wanted to put it into a proper database,

00:38:04.400 --> 00:38:06.960
and by proper I mean one that is its own process,

00:38:07.340 --> 00:38:09.460
different machines can talk to it in parallel and whatever,

00:38:09.840 --> 00:38:11.780
you know, like Postgres or Mongo or something,

00:38:12.140 --> 00:38:14.740
are there good databases that you would recommend

00:38:14.840 --> 00:38:17.400
or that you've tried, like EdgeDB or Neo4j

00:38:17.860 --> 00:38:19.740
or graph databases the right way to go,

00:38:19.860 --> 00:38:20.700
or what do you think?

00:38:20.980 --> 00:38:23.799
- It depends on what you're trying to do

00:38:23.800 --> 00:38:25.240
In terms of OpenStreetMap features,

00:38:25.380 --> 00:38:26.540
so if you're just downloading features

00:38:26.580 --> 00:38:27.540
and you're not worried about,

00:38:27.680 --> 00:38:30.460
you say those topological relationships between things,

00:38:30.580 --> 00:38:31.320
like in a street network,

00:38:31.840 --> 00:38:36.020
any tabular data structure will do.

00:38:36.420 --> 00:38:39.140
Any kind of like SQL database will do just fine.

00:38:39.260 --> 00:38:40.980
For a graph model,

00:38:41.520 --> 00:38:43.420
yeah, you'd want some kind of graph database

00:38:43.500 --> 00:38:45.700
because they can handle graph algorithms

00:38:46.280 --> 00:38:47.880
to do stuff like routing

00:38:48.340 --> 00:38:49.720
or other kinds of graph analytics

00:38:49.900 --> 00:38:52.340
like understanding connectivity on the network.

00:38:52.520 --> 00:38:54.660
- Yeah, I have this, given this node,

00:38:54.820 --> 00:38:56.340
tell me all the things that are connected to it.

00:38:56.380 --> 00:38:57.600
Like that, those kind of questions

00:38:57.680 --> 00:38:58.440
could be answered. - Yeah, those kind

00:38:58.460 --> 00:38:59.320
of questions, yeah. - Right, yeah.

00:38:59.320 --> 00:39:01.840
Yeah, they're kind of pre-computed by the indices

00:39:02.400 --> 00:39:03.200
in the structures.

00:39:03.500 --> 00:39:05.860
What about bringing in other data?

00:39:06.200 --> 00:39:08.520
You know, what if I have real estate data

00:39:08.640 --> 00:39:10.660
that doesn't come from OpenStreetMap,

00:39:10.920 --> 00:39:13.400
but I want to pull that in and overlay it

00:39:13.420 --> 00:39:14.920
with, say, zoning information,

00:39:15.540 --> 00:39:18.320
overlapped with census data that gives me revenue,

00:39:18.740 --> 00:39:21.279
you know, how much that person in that area

00:39:21.280 --> 00:39:23.560
makes per year on average or something like that.

00:39:23.820 --> 00:39:24.800
Can you answer questions like that?

00:39:25.100 --> 00:39:26.360
- Yeah, really common use case.

00:39:26.440 --> 00:39:28.980
So OSMNX can kind of do that by itself,

00:39:29.100 --> 00:39:31.720
but mostly as a tool in the toolkit to do it.

00:39:32.900 --> 00:39:34.980
So, you know, a common way that we often will do this

00:39:35.020 --> 00:39:36.600
is for accessibility analyses.

00:39:37.160 --> 00:39:39.140
So for example, here at my house,

00:39:39.620 --> 00:39:42.480
how many grocery stores could I access

00:39:42.540 --> 00:39:44.260
within a 15 minute walk?

00:39:44.320 --> 00:39:46.440
And it gives you a sense of, you know,

00:39:46.880 --> 00:39:48.740
how car dependent or not a place is.

00:39:48.800 --> 00:39:51.260
And also we can start looking at food deserts

00:39:51.260 --> 00:39:53.480
communities where people don't have access to fresh food.

00:39:53.920 --> 00:39:57.280
So for that, what you're doing is you have a model of the network, and then you also

00:39:57.440 --> 00:39:59.440
have all of this point of interest data, right?

00:39:59.520 --> 00:40:04.020
So where all these amenities are located, you would then snap them, load them onto

00:40:04.320 --> 00:40:08.420
the graph, and then you can calculate accessibility by looking at where those

00:40:08.500 --> 00:40:09.400
things are located.

00:40:09.520 --> 00:40:14.320
And you can either look at cumulative opportunities within some time horizon or

00:40:14.460 --> 00:40:16.380
distance to the nearest opportunity.

00:40:16.860 --> 00:40:21.240
You can put different decays on it, like the utility of it being so far away, drops

00:40:21.240 --> 00:40:23.080
the linear decay the further I have to go

00:40:23.140 --> 00:40:25.800
or a non-linear decay if it really drops off fast.

00:40:26.200 --> 00:40:26.840
But it's exactly that.

00:40:27.660 --> 00:40:29.620
- Yeah, if a grocery store is three miles away,

00:40:29.680 --> 00:40:32.500
it's not one third as useful as one that's one mile away.

00:40:32.560 --> 00:40:35.220
It's a little bit more to carry your groceries that far.

00:40:35.720 --> 00:40:37.520
- And similarly, there's marginal utility

00:40:37.720 --> 00:40:39.940
for the 30th grocery store that you can reach.

00:40:40.020 --> 00:40:41.220
Doesn't give you that much benefit

00:40:41.360 --> 00:40:42.940
over the 29th that you can reach.

00:40:43.720 --> 00:40:45.600
Whereas the first and second are very valuable.

00:40:46.180 --> 00:40:48.160
- Yeah, if it goes from zero to one and one to two,

00:40:48.180 --> 00:40:49.780
those are big jumps right there.

00:40:50.080 --> 00:40:50.280
- Yep.

00:40:50.960 --> 00:40:52.360
- Okay, very interesting.

00:40:52.860 --> 00:40:56.680
How about some projects that people might be thinking about?

00:40:57.460 --> 00:40:58.700
They look at this data and they're like,

00:40:58.820 --> 00:41:00.960
"Wow, this looks really detailed and neat,

00:41:00.980 --> 00:41:03.720
"and we have all these different aspects we can ask about,"

00:41:03.720 --> 00:41:05.800
but maybe they just wanna play around.

00:41:06.340 --> 00:41:08.560
- Yeah, I mean, hopefully,

00:41:08.960 --> 00:41:10.200
if you look at the Getting Started Guide

00:41:10.240 --> 00:41:11.280
or these usage examples,

00:41:11.380 --> 00:41:12.920
you'll see it's really easy to play around,

00:41:13.100 --> 00:41:14.420
two, three lines of code,

00:41:14.480 --> 00:41:17.740
and you have a visualization of your local street network.

00:41:18.120 --> 00:41:24.540
things that we've done in my lab at USC that may spark some interest. We look at

00:41:24.680 --> 00:41:28.240
air pollution exposure and driving patterns in Los Angeles to try to

00:41:28.300 --> 00:41:33.580
understand you know who's driving and where and then in turn who is exposed to

00:41:33.600 --> 00:41:39.020
that tailpipe, those tailpipe emissions from those cars. So we use OSM and X to

00:41:39.160 --> 00:41:44.120
model those street networks to simulate those trips and to look at what census

00:41:44.120 --> 00:41:50.000
tracks that stuff goes through. We also use it for studies of urban form. So that is kind

00:41:50.040 --> 00:41:57.400
of the shape, texture, density, the grain of a city. I have this series of square mile

00:41:57.780 --> 00:42:01.820
visualizations of different cities around the world. And you can really quickly see

00:42:01.920 --> 00:42:10.200
how different forms of urbanism look relative to each other. So a place like Irvine, California,

00:42:10.360 --> 00:42:14.880
in Southern California has this really coarse-grained street network.

00:42:15.580 --> 00:42:21.760
A place like Venice in Italy has incredibly fine-grained, like spiderweb street network.

00:42:22.420 --> 00:42:27.800
Stuff like that really helps to kind of convey these different modes of urbanism and urbanization.

00:42:28.540 --> 00:42:31.300
We also use these to look at disaster resilience.

00:42:32.380 --> 00:42:37.240
That is, different street networks will be better if things start going wrong around

00:42:37.240 --> 00:42:40.140
Things with more redundancy, more connectivity built in

00:42:40.180 --> 00:42:43.320
are easier to route around if parts start failing

00:42:43.460 --> 00:42:44.980
in a fire, in an earthquake.

00:42:45.420 --> 00:42:47.140
And so we can capture some of these characteristics

00:42:47.760 --> 00:42:50.240
and then make recommendations to planners and policy makers

00:42:50.360 --> 00:42:51.840
about how to make your street network,

00:42:52.360 --> 00:42:54.100
how to intervene in it to make it more resilient.

00:42:54.280 --> 00:42:57.600
- Yeah, in my area, there's an East-West highway,

00:42:57.880 --> 00:43:01.720
one of them, very few, that goes from the city west.

00:43:01.800 --> 00:43:03.300
It has to go through this mountain tunnel

00:43:03.560 --> 00:43:05.280
and it's two lanes each way in the mountain,

00:43:05.340 --> 00:43:06.460
or three lanes in the mountain tunnel.

00:43:06.600 --> 00:43:09.100
and there's even on a Saturday afternoon,

00:43:09.240 --> 00:43:12.340
there's stopped cars trying to go through that tunnel.

00:43:12.740 --> 00:43:13.660
And those are on good days.

00:43:13.720 --> 00:43:16.100
Imagine if there was an emergency, it would just be done.

00:43:16.420 --> 00:43:18.380
- Yeah, that's the 26, right?

00:43:18.940 --> 00:43:20.560
- Exactly, it is the 26.

00:43:20.780 --> 00:43:22.080
- Yeah, I used to live in Portland.

00:43:22.300 --> 00:43:27.260
I lived in Goose Hollow, and my gym was in Beaverton,

00:43:27.440 --> 00:43:29.840
so I would have to go through that tunnel to go work out.

00:43:30.120 --> 00:43:32.860
It would always be like, you know, one of these days,

00:43:33.020 --> 00:43:34.000
one of these days.

00:43:35.400 --> 00:43:38.000
- Exactly, yeah, I live about a mile from Goose Hollow

00:43:38.120 --> 00:43:38.960
up through that tunnel.

00:43:39.420 --> 00:43:40.060
So yeah. - Oh, cool.

00:43:40.380 --> 00:43:41.280
- Yeah, yeah, very cool.

00:43:41.440 --> 00:43:43.600
Yeah, but there's just, and that one's hard to fix

00:43:43.680 --> 00:43:45.700
because there's houses all along there.

00:43:45.940 --> 00:43:48.140
It's a big hill, hard to go over it.

00:43:48.400 --> 00:43:50.120
You know, it would take a lot of willpower

00:43:50.200 --> 00:43:50.980
to make another tunnel.

00:43:51.620 --> 00:43:52.580
- Yeah, interesting thing.

00:43:52.720 --> 00:43:54.440
I did my PhD at Berkeley,

00:43:54.840 --> 00:43:56.160
and there is another tunnel there

00:43:56.260 --> 00:43:58.780
that goes from that kind of inner East Bay,

00:43:59.060 --> 00:44:00.120
Berkeley, Oakland border,

00:44:00.740 --> 00:44:02.660
out to the further East suburbs

00:44:02.740 --> 00:44:04.480
like Orinda, Moraga, and so forth.

00:44:05.080 --> 00:44:07.240
And that tunnel is really old.

00:44:07.380 --> 00:44:09.260
I mean, it's, I don't know, 80 years old,

00:44:09.420 --> 00:44:10.240
maybe something like that.

00:44:10.600 --> 00:44:12.460
And they determined that when the big one

00:44:12.500 --> 00:44:15.440
does eventually hit, it will fail, it will collapse.

00:44:16.140 --> 00:44:18.940
And it's not, it's cost prohibitive

00:44:19.020 --> 00:44:20.200
to actually prevent that from happening.

00:44:20.460 --> 00:44:22.340
So the idea is it will collapse

00:44:22.740 --> 00:44:24.200
and crush everyone in that tunnel,

00:44:24.460 --> 00:44:25.780
and they will then build a new tunnel

00:44:26.020 --> 00:44:27.300
at that point when they have to.

00:44:27.420 --> 00:44:27.860
- Oh my goodness.

00:44:28.380 --> 00:44:29.500
- We have a lot of that to look forward to.

00:44:29.760 --> 00:44:30.520
(laughing)

00:44:31.360 --> 00:44:33.220
- Yeah, just go quickly when you're in the tunnel.

00:44:33.480 --> 00:44:33.940
Get out of there.

00:44:34.400 --> 00:44:34.740
>> I always did.

00:44:35.120 --> 00:44:36.860
>> Amazing.

00:44:38.880 --> 00:44:39.060
All right.

00:44:39.820 --> 00:44:47.020
Let's talk real quickly about integrating OpenOSMNX with other data science tooling,

00:44:47.140 --> 00:44:47.280
right?

00:44:47.340 --> 00:44:48.600
We have so many different things.

00:44:48.700 --> 00:44:53.860
We have PyTorch, we have Pandas, we have Polluters, all the different things.

00:44:54.100 --> 00:44:56.380
Like what are the different integration features?

00:44:56.580 --> 00:44:57.740
You know, you talked about data frames.

00:44:57.860 --> 00:45:00.560
That sounds like Pandas and GeoPandas, right?

00:45:01.279 --> 00:45:03.460
That's one sort of path across those things.

00:45:03.720 --> 00:45:10.620
- Yeah, so OSMNX is built primarily on top of three things.

00:45:10.800 --> 00:45:13.560
It's NetworkX for the graph models,

00:45:14.580 --> 00:45:17.200
Geopandas for the spatial data frames,

00:45:17.600 --> 00:45:20.560
and Matplotlib for the visualizations.

00:45:21.840 --> 00:45:24.680
In the spatial Python world,

00:45:24.760 --> 00:45:27.460
most stuff happens in the pandas ecosystem

00:45:28.000 --> 00:45:31.760
because Geopandas and PySAL and similar tools

00:45:31.760 --> 00:45:33.880
are very pandas-oriented.

00:45:34.600 --> 00:45:37.180
I know there's been some work toward geopolars,

00:45:37.380 --> 00:45:39.440
but it's kind of in its infancy,

00:45:39.800 --> 00:45:41.460
as far as I know, to this extent.

00:45:41.640 --> 00:45:44.140
But that'll be great when that's available.

00:45:44.720 --> 00:45:45.760
NetworkX is another funny one

00:45:45.900 --> 00:45:48.940
because it's a pure Python implementation.

00:45:49.120 --> 00:45:49.760
It has a lot of loops,

00:45:49.820 --> 00:45:51.640
and so it can go really slow for calculating

00:45:52.040 --> 00:45:56.340
some of these big time complexity graph algorithms,

00:45:56.540 --> 00:45:58.060
things like betweenness centrality,

00:45:58.580 --> 00:46:00.940
where you have this massive OD native,

00:46:01.300 --> 00:46:03.400
basically all the nodes to all the nodes.

00:46:03.700 --> 00:46:05.740
- Yeah, yeah, some combinatorial craziness.

00:46:06.160 --> 00:46:08.320
- It ends up being very time consuming

00:46:08.440 --> 00:46:10.480
to calculate those kinds of things

00:46:10.920 --> 00:46:13.920
for a metro area sized network model.

00:46:14.700 --> 00:46:16.740
So we'll integrate with other tools.

00:46:17.280 --> 00:46:19.940
iGraph does that in C.

00:46:20.580 --> 00:46:22.960
Also using tools like QGraph

00:46:23.020 --> 00:46:25.060
where you can do it on the GPU instead

00:46:25.340 --> 00:46:26.780
can be really fun. - Oh wow, okay, yeah.

00:46:27.740 --> 00:46:31.280
- But it's limited because of the weighting scheme

00:46:31.280 --> 00:46:34.160
that you say, I want to minimize travel time

00:46:34.220 --> 00:46:35.000
or stuff like that.

00:46:35.200 --> 00:46:35.500
- I see.

00:46:37.160 --> 00:46:41.080
- Yeah, and then also integrated with Folium

00:46:41.420 --> 00:46:45.600
to create interactive leaflet web maps out of the box.

00:46:46.020 --> 00:46:50.240
- Yeah, I wonder how that the free-threaded Python stuff

00:46:50.320 --> 00:46:52.220
will affect some of those computational things.

00:46:52.560 --> 00:46:54.720
Like that everything compared with everything else

00:46:54.860 --> 00:46:57.580
sounds like a so-called embarrassingly parallel

00:46:58.100 --> 00:46:59.400
sort of problem, right?

00:46:59.720 --> 00:47:04.280
And so, you have 10 cores, so let's just do 10 blocks

00:47:04.320 --> 00:47:05.880
of them all in parallel and you know.

00:47:06.080 --> 00:47:09.100
- Yeah, so that's what we do when we do it in pure Python.

00:47:09.340 --> 00:47:14.080
So we'll use multi-processing generally with all your CPUs.

00:47:14.160 --> 00:47:18.700
The only challenge is that your OD matrix,

00:47:18.980 --> 00:47:20.660
your origin destination matrix is growing

00:47:20.740 --> 00:47:23.500
at this exponential rate, but then there's a linear number

00:47:23.580 --> 00:47:25.400
of cores, so going from one to 24,

00:47:25.480 --> 00:47:27.020
you're dividing by a factor of 24.

00:47:27.440 --> 00:47:30.100
But when you have say a million nodes

00:47:30.300 --> 00:47:32.700
times a million nodes in your graph,

00:47:32.940 --> 00:47:34.440
it's going to take a long time.

00:47:34.700 --> 00:47:36.100
- It's still gonna be slow, but it's--

00:47:36.100 --> 00:47:38.280
- You've got from months down to weeks.

00:47:39.860 --> 00:47:40.980
- Yeah, I mean, you're still dividing it

00:47:41.060 --> 00:47:41.860
by the number of cores,

00:47:42.260 --> 00:47:44.800
but it doesn't necessarily mean it's super fast.

00:47:45.240 --> 00:47:46.580
Although the GPU stuff seems like

00:47:46.640 --> 00:47:48.320
it could absolutely fly, right?

00:47:48.740 --> 00:47:50.660
- Yeah, that makes a big difference.

00:47:50.880 --> 00:47:53.320
And I think that's really the area of growth

00:47:53.440 --> 00:47:55.880
where the handling, I mean, basically getting out

00:47:55.880 --> 00:47:57.520
of Python loops in the first place

00:47:57.900 --> 00:47:59.480
is the biggest area of growth.

00:47:59.800 --> 00:48:00.820
And then doing things on a,

00:48:01.080 --> 00:48:01.880
since these are really just

00:48:02.140 --> 00:48:03.920
very simple linear algebra problems,

00:48:04.260 --> 00:48:06.060
being able to do them on a GPU

00:48:06.260 --> 00:48:07.160
makes it much more efficient.

00:48:07.500 --> 00:48:09.880
- Yeah, did you hear about this thing,

00:48:10.240 --> 00:48:12.340
this new NVIDIA, what, I don't know what it's called,

00:48:12.580 --> 00:48:14.480
Project Digits, where they announced

00:48:14.520 --> 00:48:18.060
a $3,000 desktop AI computer?

00:48:18.160 --> 00:48:20.220
I mean, they call it AI, but really it's just a GPU.

00:48:20.740 --> 00:48:22.340
- That is, no, I hadn't heard about that.

00:48:22.620 --> 00:48:25.080
- And this thing, it's the size of a Mac mini.

00:48:25.360 --> 00:48:26.960
It's this, if you look at the pictures,

00:48:27.100 --> 00:48:28.740
a little bit of a golden thing.

00:48:28.920 --> 00:48:30.240
It's kind of clever they made it gold,

00:48:30.360 --> 00:48:35.160
but that's a massive computer sitting next to you.

00:48:35.580 --> 00:48:35.780
- Yeah.

00:48:36.000 --> 00:48:36.880
- You could run that.

00:48:36.960 --> 00:48:38.640
This is pretty interesting actually, I think.

00:48:39.680 --> 00:48:41.740
- Yeah, yeah, that is.

00:48:42.300 --> 00:48:43.220
I mean, it's shocking too,

00:48:43.360 --> 00:48:44.380
because it looks so much smaller

00:48:44.440 --> 00:48:48.380
than just an Nvidia card in your desktop.

00:48:49.080 --> 00:48:51.700
- I think it basically is just the GPU.

00:48:52.180 --> 00:48:52.400
- Right.

00:48:52.460 --> 00:48:53.260
- Nothing to do with graphics.

00:48:53.720 --> 00:48:58.880
just remote into it over, I don't know, a terminal or however you, or maybe you set

00:48:58.920 --> 00:49:02.700
it as the Docker host and then you just do Docker locally, but it runs there, you know,

00:49:02.760 --> 00:49:03.340
that type of thing.

00:49:03.680 --> 00:49:05.560
I don't know how it works, but I kind of want one.

00:49:05.840 --> 00:49:05.960
>> Yeah.

00:49:07.060 --> 00:49:07.960
I mean, it looks sexy enough.

00:49:08.040 --> 00:49:09.120
Of course you would want one, right?

00:49:09.880 --> 00:49:10.160
>> Of course.

00:49:10.280 --> 00:49:13.520
But if you had questions like that, if you say I have a million nodes and I could run

00:49:13.600 --> 00:49:18.620
that on a GPU, getting something like this that's, you know, kind of the H100 style of

00:49:18.660 --> 00:49:22.120
like the really large just meant for compute, not really a graphics card.

00:49:23.000 --> 00:49:25.320
like that would really unlock some interesting options.

00:49:25.760 --> 00:49:26.480
Yeah, totally.

00:49:26.720 --> 00:49:27.180
I mean, yeah.

00:49:27.200 --> 00:49:32.220
So I have a, a GeForce card in my desktop that I'll pass

00:49:32.280 --> 00:49:33.400
them and that stuff locally onto.

00:49:33.660 --> 00:49:37.640
But, another one of the academic benefits at USC, we have a high

00:49:37.920 --> 00:49:43.440
performance computing cluster that, I can schedule tasks to run on that,

00:49:43.600 --> 00:49:47.320
say over winter break and then come back in January and, and the month

00:49:47.480 --> 00:49:51.160
of, of, 1000 CPUs is all done.

00:49:51.740 --> 00:49:52.340
That's amazing.

00:49:52.400 --> 00:49:57.200
And we had a mainframe, a silicon graphics mainframe

00:49:57.280 --> 00:50:00.100
when I was studying math that we could all work on

00:50:00.120 --> 00:50:01.840
in this group of maybe 10 of us.

00:50:02.140 --> 00:50:04.740
And it wasn't as big as what you're saying,

00:50:04.820 --> 00:50:07.480
but it was a quite expensive, big machine.

00:50:07.900 --> 00:50:09.260
It had its own room and it was really allowed

00:50:09.320 --> 00:50:10.040
to go into that room.

00:50:10.340 --> 00:50:12.400
And I remember we came in to,

00:50:12.840 --> 00:50:14.840
I came in to do whatever I was working on

00:50:14.880 --> 00:50:17.440
as a grad student or whatever, I think I was a senior.

00:50:17.960 --> 00:50:19.780
Anyway, I came in to work on my project

00:50:20.140 --> 00:50:21.520
and nobody could access it.

00:50:21.780 --> 00:50:23.380
and it was still in there making loud noises

00:50:23.460 --> 00:50:25.800
like it was running, but it acted like it wasn't running.

00:50:25.860 --> 00:50:26.840
And so I'm like, what is going on?

00:50:27.100 --> 00:50:29.020
One of the other grad students had run a job

00:50:29.080 --> 00:50:29.940
like you're talking about,

00:50:30.280 --> 00:50:32.080
but they were having trouble getting into work

00:50:32.400 --> 00:50:34.140
'cause they were math people, not programmers.

00:50:34.380 --> 00:50:36.380
And they started logging everything.

00:50:36.800 --> 00:50:39.020
And there were no limits on what people could do

00:50:39.120 --> 00:50:41.180
to the computer, the people that set it up.

00:50:41.780 --> 00:50:45.120
And so what had happened is it ran 100% CPU

00:50:45.320 --> 00:50:46.740
on all the cores all night logging

00:50:46.900 --> 00:50:47.840
until it ran out of space.

00:50:47.900 --> 00:50:49.640
And then apparently the computer won't run anymore

00:50:49.760 --> 00:50:50.820
if it has zero more bytes.

00:50:50.980 --> 00:50:52.380
needed some temp file or something.

00:50:52.980 --> 00:50:54.820
And so it just, it was just done.

00:50:55.240 --> 00:50:58.500
I imagine you guys have more guardrails than that.

00:50:59.060 --> 00:51:00.640
- Yeah, a lot of guardrails.

00:51:00.700 --> 00:51:02.960
I would love to try to do something like that

00:51:03.020 --> 00:51:06.460
just for the yuck sometime, but we got a lot of-

00:51:06.460 --> 00:51:09.180
- The admins of that computer

00:51:09.180 --> 00:51:10.980
would not please with that grad student.

00:51:10.980 --> 00:51:12.400
- I can only imagine.

00:51:12.400 --> 00:51:14.100
- It took a long time to get it going.

00:51:14.100 --> 00:51:16.800
It's like a day of work to get it turned back on.

00:51:16.800 --> 00:51:18.620
'Cause they didn't even know what was wrong with it at first

00:51:18.620 --> 00:51:19.280
it just wouldn't turn on.

00:51:19.620 --> 00:51:23.500
- Oh well, jumping back a moment to the,

00:51:23.740 --> 00:51:24.840
no, that's not the one I wanted to copy,

00:51:25.300 --> 00:51:28.260
to the integration, have you considered

00:51:28.460 --> 00:51:29.260
working with narwhals?

00:51:30.140 --> 00:51:32.800
- I looked into narwhals recently.

00:51:32.960 --> 00:51:35.040
My understanding is one of the things that does well

00:51:35.060 --> 00:51:37.620
is it kind of abstracts away from pandas versus polars,

00:51:38.200 --> 00:51:39.880
so you're less tool dependent, right?

00:51:40.380 --> 00:51:41.660
- Yeah, and it also lets people

00:51:42.040 --> 00:51:43.540
who want to consume your library,

00:51:44.000 --> 00:51:45.900
who want to do their work in polars,

00:51:46.140 --> 00:51:47.640
talk polars to your project,

00:51:47.740 --> 00:51:49.740
and people want to do pandas, talk pandas,

00:51:50.200 --> 00:51:53.820
as well as QDF, modem, pyro, and other.

00:51:53.900 --> 00:51:55.900
It kind of is an adapting layer,

00:51:56.020 --> 00:51:57.860
so people can work in their native framework

00:51:58.060 --> 00:51:58.880
and then talk to you.

00:51:59.220 --> 00:52:02.020
- Yeah, I mean, yeah, on paper it sounds great.

00:52:02.080 --> 00:52:03.180
I haven't played with it yet,

00:52:03.300 --> 00:52:04.600
other than just being familiar with it,

00:52:04.680 --> 00:52:07.620
but I mean, that sounds like the ideal, right?

00:52:07.660 --> 00:52:09.840
We shouldn't be enforcing these certain APIs

00:52:10.020 --> 00:52:11.160
or languages on people.

00:52:11.480 --> 00:52:12.700
- Yeah, it does look interesting.

00:52:12.900 --> 00:52:16.900
I believe its foundational internals are maybe just the API,

00:52:16.960 --> 00:52:19.040
But there are Polars, not pandas,

00:52:19.140 --> 00:52:20.540
so maybe that's not as good of a fit.

00:52:20.620 --> 00:52:23.760
But it could be an interesting thing to look in the future to

00:52:24.540 --> 00:52:25.540
make it native to

00:52:25.660 --> 00:52:27.940
all the different DataFrame libraries that people want to talk in.

00:52:28.180 --> 00:52:29.560
>> Yeah, definitely.

00:52:30.140 --> 00:52:31.140
>> Are you going to need a new grant?

00:52:31.500 --> 00:52:33.900
>> Yeah. Here's the basic science stuff.

00:52:34.080 --> 00:52:36.800
If I'm interested in network models,

00:52:36.880 --> 00:52:39.120
I don't know about getting into the nuts and bolts of

00:52:39.420 --> 00:52:42.980
which DataFrame API we're going to have people use.

00:52:43.980 --> 00:52:46.440
- Yeah, yeah, absolutely.

00:52:47.280 --> 00:52:50.280
All right, well, let's close this whole conversation out

00:52:51.120 --> 00:52:53.020
by talking about something that I know

00:52:53.060 --> 00:52:56.120
is on a lot of people's minds, and that's LLMs.

00:52:56.720 --> 00:53:00.960
And what do LLMs mean for this mapping data

00:53:01.000 --> 00:53:02.420
and the types of questions you can answer

00:53:02.540 --> 00:53:05.200
in OSMNx, all these types of things?

00:53:05.280 --> 00:53:07.160
Like, how's that shaping your world?

00:53:08.060 --> 00:53:11.160
- Yeah, so two ways that I like to think about it.

00:53:11.220 --> 00:53:14.640
One is what LLMs have to offer us today.

00:53:14.900 --> 00:53:17.260
And then one is what LLMs have to offer us,

00:53:17.320 --> 00:53:18.660
say five to 10 years from now.

00:53:18.780 --> 00:53:20.900
That is, how do we future-proof ourselves,

00:53:21.380 --> 00:53:23.320
our careers, our livelihoods?

00:53:23.660 --> 00:53:25.600
And I mean, or just optimistically,

00:53:25.760 --> 00:53:28.160
how do we really get ahead of it to take advantage

00:53:28.440 --> 00:53:30.440
of nice things that they'll have to offer?

00:53:30.820 --> 00:53:34.740
Today, I am deeply unimpressed with most of the use cases

00:53:34.860 --> 00:53:36.140
that I see for it.

00:53:36.440 --> 00:53:38.500
I think that the outputs only look good

00:53:38.540 --> 00:53:40.099
to people who aren't experts

00:53:40.100 --> 00:53:41.920
and don't know how wrong it is.

00:53:42.200 --> 00:53:43.220
Does some things well, you know,

00:53:43.380 --> 00:53:45.420
like having a co-pilot while you're coding

00:53:45.600 --> 00:53:46.500
and having it recommending.

00:53:47.060 --> 00:53:47.580
That's nice.

00:53:47.680 --> 00:53:49.680
I mean, it's like tab complete from years ago.

00:53:49.800 --> 00:53:51.780
It's the same kind of thing, just iterating.

00:53:52.100 --> 00:53:54.780
But you know, when someone tells it to,

00:53:55.200 --> 00:53:56.220
you know, here's the prompt,

00:53:56.340 --> 00:53:57.780
generate my algorithm for me.

00:53:58.160 --> 00:53:58.780
Two things.

00:53:59.280 --> 00:54:01.560
One, it very often doesn't do that good of a job

00:54:01.680 --> 00:54:02.340
even at this point.

00:54:02.440 --> 00:54:05.980
And number two, if you don't enjoy doing that kind of thing,

00:54:06.020 --> 00:54:09.259
I'm not sure why you're in software development

00:54:09.260 --> 00:54:10.040
in the first place.

00:54:10.700 --> 00:54:10.860
- I know.

00:54:10.880 --> 00:54:12.600
- For me, when I interface with it,

00:54:12.920 --> 00:54:14.180
it's usually in the classroom.

00:54:14.680 --> 00:54:16.220
And you'll have, so, you know,

00:54:16.300 --> 00:54:17.560
people like to complain kids these days.

00:54:17.680 --> 00:54:19.420
It's the same way it was when I was in school.

00:54:19.940 --> 00:54:22.180
You know, a third of the class loves a subject.

00:54:22.640 --> 00:54:23.500
They're just killing it.

00:54:23.720 --> 00:54:24.400
They wanna be there.

00:54:24.460 --> 00:54:25.440
They want a job in this.

00:54:25.760 --> 00:54:27.200
A third of the class, they're like,

00:54:27.260 --> 00:54:28.280
"Well, it's a required class.

00:54:28.340 --> 00:54:29.700
"I'll try to do what I can."

00:54:29.700 --> 00:54:31.900
And a third of them say, "I don't know why I'm here.

00:54:31.920 --> 00:54:33.160
"Why is this a required course?

00:54:33.240 --> 00:54:34.080
"I hate this.

00:54:34.480 --> 00:54:35.620
"Is there any way I can cheat

00:54:35.760 --> 00:54:37.020
"to just get a passing grade?"

00:54:37.260 --> 00:54:38.080
- Where's my shortcut?

00:54:38.580 --> 00:54:39.080
- Exactly.

00:54:39.800 --> 00:54:42.060
I mean, and you know, the difference today

00:54:42.160 --> 00:54:44.580
is that LLMs make it so much easier

00:54:44.660 --> 00:54:47.380
and they really normalized cheating as well,

00:54:47.740 --> 00:54:50.820
where we don't have that good of systems in place

00:54:50.920 --> 00:54:53.180
to be able to detect it for code,

00:54:53.540 --> 00:54:55.480
for writing, for anything.

00:54:55.880 --> 00:54:57.300
And I think one of the problems here,

00:54:57.660 --> 00:55:01.000
you know, it goes back to like licensing or attribution.

00:55:01.360 --> 00:55:03.120
When we normalize this kind of cheating,

00:55:03.220 --> 00:55:05.200
we're normalizing taking credit

00:55:05.320 --> 00:55:07.000
for things that aren't our work.

00:55:07.080 --> 00:55:09.520
And if we're doing that in school, we build those habits,

00:55:09.720 --> 00:55:10.600
what's it gonna look like

00:55:10.700 --> 00:55:12.100
when we're working in the workforce?

00:55:12.220 --> 00:55:14.780
We either don't have the skills that people think we have,

00:55:15.020 --> 00:55:18.140
or we think it's just normal, acceptable practice

00:55:18.600 --> 00:55:20.340
to copy and paste and say,

00:55:20.400 --> 00:55:22.640
here's my intellectual contribution.

00:55:22.820 --> 00:55:23.920
- It's too much of a crutch,

00:55:24.000 --> 00:55:26.460
and if maybe it solves 90% of the problems,

00:55:26.580 --> 00:55:27.760
but that 10%, it doesn't,

00:55:28.000 --> 00:55:30.720
you're fully incapable of approaching that problem, right?

00:55:31.040 --> 00:55:31.880
- Exactly, yeah.

00:55:32.420 --> 00:55:34.340
And I think, so that's the first part,

00:55:34.360 --> 00:55:35.520
what LLM's offered us today.

00:55:35.640 --> 00:55:38.480
I think the second part is say five to 10 years from now.

00:55:39.060 --> 00:55:41.160
Part of it is scary and part of it is exciting.

00:55:41.280 --> 00:55:44.600
I think that coding as it looks today

00:55:44.820 --> 00:55:47.460
is going to largely go away over my lifetime

00:55:48.300 --> 00:55:52.500
because coding is this mix of art and intellectual labor

00:55:52.800 --> 00:55:53.920
and manual labor.

00:55:54.340 --> 00:55:57.580
The manual labor parts will be going away

00:55:57.600 --> 00:55:59.340
and that's where a lot of people use LLMs now

00:55:59.360 --> 00:56:02.080
to reduce some of that grind of coding.

00:56:02.660 --> 00:56:05.119
And I think it's important for us to figure out

00:56:05.120 --> 00:56:07.580
where those intellectual contributions are,

00:56:07.660 --> 00:56:09.360
where the art, the poetry of coding

00:56:10.100 --> 00:56:13.220
remains a human contribution moving forward,

00:56:13.880 --> 00:56:16.240
where we have that sort of human in the loop

00:56:16.600 --> 00:56:19.080
to make ethical decisions that we don't pass off,

00:56:19.640 --> 00:56:21.740
where it is humans who are doing some of the architecting

00:56:21.780 --> 00:56:22.980
and not just handing it off saying,

00:56:23.540 --> 00:56:25.960
"Here's a prompt, now redesign our financial system

00:56:26.140 --> 00:56:27.240
from the ground up for us,"

00:56:27.240 --> 00:56:31.799
but that it remains human guardrails and human ethics

00:56:31.800 --> 00:56:36.960
and human notions of justice that we use AI to help us,

00:56:37.060 --> 00:56:38.360
but doesn't replace that.

00:56:38.680 --> 00:56:41.220
- Yeah, I feel like there's gonna be a lot of people

00:56:41.240 --> 00:56:43.760
who are programmers now are gonna have to kind of be

00:56:43.820 --> 00:56:47.200
a senior tech team lead type of thing,

00:56:47.540 --> 00:56:50.500
where the team is asking the LLM to do stuff for you.

00:56:50.780 --> 00:56:53.260
And that's gonna be awesome for those people, us,

00:56:53.600 --> 00:56:55.020
but for the people who are brand new,

00:56:55.100 --> 00:56:57.580
there's gonna be a wider gap to try to cross.

00:56:58.020 --> 00:57:00.759
It's gonna be harder and harder to go from real beginner

00:57:00.760 --> 00:57:04.580
to that level when, who's going to employ you

00:57:04.900 --> 00:57:07.060
when it takes you a day and I can ask the LLM

00:57:07.140 --> 00:57:08.980
to do it in five minutes and I got to review it either way.

00:57:09.460 --> 00:57:12.640
That's a very concerning social consequence, I think.

00:57:13.160 --> 00:57:13.860
- No, exactly.

00:57:13.980 --> 00:57:17.120
I think those kind of entry-level jobs

00:57:17.180 --> 00:57:20.280
are very much more labor-focused, right?

00:57:20.600 --> 00:57:22.840
The senior dev isn't doing that work

00:57:23.260 --> 00:57:27.140
because someone with less experience, less pay can do it.

00:57:27.680 --> 00:57:29.880
And if LLMs replace that over time,

00:57:29.920 --> 00:57:31.840
It's really hard to get your foot in the door in that industry.

00:57:31.900 --> 00:57:33.420
- Yeah, it can be like COBOL programmers

00:57:33.520 --> 00:57:35.420
did not a program without an LLM someday.

00:57:35.800 --> 00:57:36.180
(laughing)

00:57:36.699 --> 00:57:36.800
- Yeah.

00:57:37.519 --> 00:57:37.840
(laughing)

00:57:38.220 --> 00:57:39.720
- I don't know if that's good or bad,

00:57:39.800 --> 00:57:40.620
but it's gonna be weird.

00:57:40.900 --> 00:57:43.840
Anyway, I think it's probably pretty interesting.

00:57:44.040 --> 00:57:46.760
And given, you know, access with your API

00:57:46.980 --> 00:57:47.680
and with all this data,

00:57:47.780 --> 00:57:49.220
I'm sure people will be able to ask

00:57:49.340 --> 00:57:50.880
and answer interesting questions with it.

00:57:51.080 --> 00:57:51.620
- That's the hope.

00:57:52.480 --> 00:57:53.040
- Indeed, all right.

00:57:53.780 --> 00:57:55.420
Two really quick things to close out our conversation.

00:57:55.920 --> 00:57:58.679
Roadmap, anything on the roadmap coming real soon

00:57:58.680 --> 00:58:00.680
that people have been asking about, thinking about?

00:58:01.060 --> 00:58:05.320
- Yeah, so I just released V 2.0,

00:58:06.180 --> 00:58:07.420
I don't know, a month or so ago.

00:58:08.060 --> 00:58:08.940
And so, thank you.

00:58:09.280 --> 00:58:14.140
And that was really just a year of rethinking the API.

00:58:14.540 --> 00:58:16.100
I was gonna allow myself breaking changes,

00:58:16.300 --> 00:58:17.120
really cleaning things up.

00:58:17.180 --> 00:58:19.800
I added type annotations for the first time.

00:58:19.860 --> 00:58:22.700
I really changed the linting and formatting,

00:58:23.020 --> 00:58:24.260
CI, pre-commit, everything.

00:58:24.960 --> 00:58:27.800
So it's a much more rigorous package at this point.

00:58:28.180 --> 00:58:30.200
I'm taking a breather right now,

00:58:31.340 --> 00:58:33.980
where I don't have that much big on the horizon.

00:58:34.700 --> 00:58:37.060
I try to keep a really clean issue board as well,

00:58:37.120 --> 00:58:39.760
where I quickly triage, this is in scope, this is not.

00:58:40.340 --> 00:58:42.100
- Yeah, I noticed you have three open issues

00:58:42.140 --> 00:58:43.600
and zero PRs, which is awesome.

00:58:43.920 --> 00:58:45.520
- Yeah, I try to do it courteously,

00:58:45.720 --> 00:58:46.980
where I'll tell people a lot of the time,

00:58:47.020 --> 00:58:48.480
you know, this isn't in scope for the project,

00:58:48.540 --> 00:58:51.200
but I appreciate the suggestion, but I'm busy,

00:58:51.540 --> 00:58:53.720
so keeping a clean issue board makes my life simple.

00:58:53.900 --> 00:58:56.839
So short answer, I'm taking a breather

00:58:56.840 --> 00:58:58.400
instead of road mapping in January.

00:58:59.200 --> 00:59:00.700
- But you just had a big release, which is cool.

00:59:01.000 --> 00:59:01.120
- Yeah.

00:59:01.440 --> 00:59:01.560
- Yeah.

00:59:02.660 --> 00:59:03.440
Contributions accepted?

00:59:04.300 --> 00:59:04.820
- Absolutely.

00:59:04.980 --> 00:59:08.760
And very often what I ask when someone opens an issue

00:59:08.820 --> 00:59:10.360
and I say, "Yeah, that does sound useful,

00:59:10.920 --> 00:59:12.719
would you like to open a PR?"

00:59:14.140 --> 00:59:16.160
And as much as this is my side hustle,

00:59:16.240 --> 00:59:19.020
most of the pull requests that I add to it

00:59:19.480 --> 00:59:21.680
are very much aligned with a current

00:59:21.720 --> 00:59:23.680
or recent research project that I'm working on.

00:59:24.340 --> 00:59:27.980
So for others, if you see a gap or a cool feature

00:59:28.060 --> 00:59:29.780
that could make people's lives easier,

00:59:30.100 --> 00:59:31.540
better analytics down the road,

00:59:31.920 --> 00:59:33.820
please propose it and I'd love a contribution.

00:59:34.140 --> 00:59:34.340
- Excellent.

00:59:34.840 --> 00:59:35.800
All right, final call to action.

00:59:35.920 --> 00:59:37.700
People are psyched about mapping.

00:59:38.100 --> 00:59:38.700
They wanna get started.

00:59:38.840 --> 00:59:39.220
What do you tell 'em?

00:59:40.740 --> 00:59:44.340
- I tell them to work through existing examples

00:59:44.420 --> 00:59:45.620
from the tools that are out there.

00:59:45.780 --> 00:59:47.320
If you haven't done any kind of mapping before,

00:59:47.640 --> 00:59:50.320
there's a lot of cool packages in R and in Python.

00:59:51.080 --> 00:59:52.280
Find something you're comfortable with.

00:59:53.120 --> 00:59:54.200
work through some tutorials,

00:59:54.980 --> 00:59:56.740
and then figure out something close to home.

00:59:56.780 --> 00:59:59.200
It's so much easier if you have that kind of

00:59:59.280 --> 01:00:00.760
local motivation, local knowledge.

01:00:01.220 --> 01:00:03.280
Do some mapping, do an analysis in your community

01:00:03.480 --> 01:00:04.780
for something that's bothering you,

01:00:04.880 --> 01:00:06.100
you know, you think could be better.

01:00:06.560 --> 01:00:06.820
- Excellent.

01:00:07.200 --> 01:00:08.520
All right, well, thank you for being here

01:00:08.800 --> 01:00:10.060
and congrats on that cool project.

01:00:10.420 --> 01:00:11.240
- Thank you very much.

01:00:12.760 --> 01:00:15.260
- This has been another episode of Talk Python To Me.

01:00:15.760 --> 01:00:17.060
Thank you to our sponsors.

01:00:17.540 --> 01:00:18.740
Be sure to check out what they're offering.

01:00:18.840 --> 01:00:20.120
It really helps support the show.

01:00:20.840 --> 01:00:24.460
This episode is sponsored by Posit Connect from the makers of Shiny.

01:00:25.080 --> 01:00:28.980
Publish, share, and deploy all of your data projects that you're creating using Python.

01:00:29.460 --> 01:00:35.700
Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quarto, Reports, Dashboards, and APIs.

01:00:36.440 --> 01:00:38.040
Posit Connect supports all of them.

01:00:38.320 --> 01:00:42.460
Try Posit Connect for free by going to talkpython.fm/posit.

01:00:42.800 --> 01:00:43.700
P-O-S-I-T.

01:00:44.560 --> 01:00:45.520
Want to level up your Python?

01:00:45.920 --> 01:00:49.600
We have one of the largest catalogs of Python video courses over at Talk Python.

01:00:50.000 --> 01:00:54.660
Our content ranges from true beginners to deeply advanced topics like memory and async.

01:00:55.060 --> 01:00:57.340
And best of all, there's not a subscription in sight.

01:00:57.740 --> 01:01:00.220
Check it out for yourself at training.talkpython.fm.

01:01:00.960 --> 01:01:05.200
Be sure to subscribe to the show, open your favorite podcast app, and search for Python.

01:01:05.600 --> 01:01:06.460
We should be right at the top.

01:01:06.960 --> 01:01:12.500
You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the Direct

01:01:12.640 --> 01:01:15.780
RSS feed at /rss on talkpython.fm.

01:01:16.520 --> 01:01:18.780
We're live streaming most of our recordings these days.

01:01:19.100 --> 01:01:22.720
If you want to be part of the show and have your comments featured on the air, be sure

01:01:22.780 --> 01:01:26.680
to subscribe to our YouTube channel at talkpython.fm/youtube.

01:01:27.460 --> 01:01:28.640
This is your host Michael Kennedy.

01:01:29.100 --> 01:01:29.980
Thanks so much for listening.

01:01:30.140 --> 01:01:31.120
I really appreciate it.

01:01:31.380 --> 01:01:33.000
Now get out there and write some Python code.