Latest / Talk Python To Me / #295: GIS + Python
Transcript
- 0:00Geography of the Study of Places and Relationships Between People and Their Environments.
- 0:04Often we think of maps, but maps are static.
- 0:07GIS gets interesting when you realize that we're studying and visualizing data
- 0:11flowing through these locations and communities.
- 0:13In this episode, you'll meet Silas Toms.
- 0:15He's an author of several Python GIS books and the co-host of the Mapist Hour podcast.
- 0:20Are you ready to dive into GIS with Python?
- 0:23This is Talk Python To Me, episode 295, recorded October 27th, 2020.
- 0:29Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the
- 0:46ecosystem, and the personalities.
- 0:48This is your host, Michael Kennedy.
- 0:50Follow me on Twitter where I'm @mkennedy, and keep up with the show and listen to past
- 0:54episodes at talkpython.fm, and follow the show on Twitter via at Talk Python.
- 0:59This episode is brought to you by Linode and Talk Python Training.
- 1:02Please check out the offers during their segments.
- 1:05It really helps support the show.
- 1:06At Talk Python, we run a bunch of web apps and web APIs.
- 1:11These power the training courses as well as the mobile apps on iOS and Android.
- 1:15If I had to build these from scratch again today, there's no doubt which framework I would
- 1:20use.
- 1:20It's FastAPI.
- 1:22To me, FastAPI is the embodiment of modern Python and modern APIs.
- 1:26You have beautiful usage of type annotations.
- 1:29You have model binding and validation with Pydantic.
- 1:31And you have first-class async and await support.
- 1:35If you're building or rebuilding a web app, you owe it to yourself to check out our newest
- 1:40course, Modern APIs with FastAPI over at Talk Python Training.
- 1:43This is the first course in a series we're building on FastAPI.
- 1:47And for just $39, it'll take you from interested to production with FastAPI.
- 1:52To learn more and get started today, just visit talkpython.fm/fastapi or click the link
- 1:58in your podcast player show notes.
- 2:00Silas, welcome to Talk Python and me.
- 2:02Oh, thank you so much for having me, Michael.
- 2:04Yeah, it's great to have you.
- 2:05Since this is a GIS episode, where are you calling in from?
- 2:09Where are you located?
- 2:10I'm in San Francisco, where I've lived for the last 13 years now, since I moved down for
- 2:15grad school.
- 2:16Oh, right on.
- 2:17I grew up in Northern California, kind of in the middle of nowhere, but I always really
- 2:21enjoyed this city and I've come to really love it.
- 2:24Yeah, it's a neat place.
- 2:26If you were to jump on I-5, the north-south major highway for people who don't know, and
- 2:30go north for a very long time until the next big city you hit, you'd get to Portland,
- 2:34where I am, so right on.
- 2:36You know, I think Ashland's a big city.
- 2:37You know, Ashland is nice to visit.
- 2:40Yeah.
- 2:40But if you could throw a rock across it, it's not a big city.
- 2:43Yeah, there you go.
- 2:44Yeah.
- 2:44You can only have so much Shakespeare in your life.
- 2:46Yeah.
- 2:47Yeah, that's right.
- 2:47That's right.
- 2:48We're going to talk about GIS and Python and all those sorts of things, but a bunch of
- 2:53cool job experiences that you've had, as well as some of the libraries and applications and
- 2:57whatnot.
- 2:58Well, let's start with the beginning.
- 2:59How'd you get into programming in Python?
- 3:01It was kind of a circuitous route.
- 3:03I mean, my parents, of all things, were organic farmers up in the middle of nowhere when I was
- 3:08born in Northern Humboldt County.
- 3:09And my dad had always kind of had an interest in technology.
- 3:13He wasn't averse or anything.
- 3:15So when I was about eight, he got a little computer that was programmable that had a
- 3:20basic program on it.
- 3:21And so he used that to keep track of sales at our fruit stand.
- 3:25Oh, right on.
- 3:26And he taught me how to...
- 3:27Yeah, it was cute.
- 3:29And probably 800 lines or something, which seemed amazing to me.
- 3:32Because he taught me how to do a little bit and I would do little silly things when I was
- 3:36seven years old or whatever.
- 3:37You know what's interesting about code is it's not always about how big or how complex it is.
- 3:42Sometimes it's about what it empowers or the problem that it solves.
- 3:46Like I can think of a couple of libraries and it's like, gosh, this is so nice this exists.
- 3:51And it's like a hundred lines of code.
- 3:53Yeah.
- 3:53But I just love that it exists, you know?
- 3:55Completely.
- 3:56Like we'll get into it.
- 3:57But like PyShape, it's an implementation reading shapefiles for geospatial data to format.
- 4:02And it's relatively simple, compact, and it's beautiful.
- 4:05I love it.
- 4:06Yeah, for sure.
- 4:06Okay.
- 4:07So you had this experience with this basic app that was running the family business?
- 4:10Yeah.
- 4:11Well, there was that.
- 4:12And then in high school, around 97, I took an elective in computer programming, also basic,
- 4:16which I didn't like love the other crowd in the room, really.
- 4:20I was always thinking of myself as a little more active.
- 4:22I played sports, but I did like it.
- 4:24I just, I couldn't fully identify with it.
- 4:26And being from like a rural kind of macho county, like it just didn't occur to me that
- 4:32that was something I could do.
- 4:34And if you could see the future, like...
- 4:36Yeah, yeah.
- 4:37Now all the cool stuff you can build and like how sort of tech has changed in perception,
- 4:42right?
- 4:42Who knows?
- 4:42Maybe it would have...
- 4:43Well, maybe if I could just read the newspaper, because at that time, it was like the first dot-com
- 4:46wave.
- 4:47And I just wasn't really in the mindset that that was something I would do with my career.
- 4:51But I went to college.
- 4:52I went to Santa Cruz, and then I was kind of homesick.
- 4:55I finished up back at Humboldt State University and got really into geography, which is a really
- 5:01interesting quasi-science, I guess you'd say, that has a lot of really interesting theories
- 5:07about why the world is, how it's divided up and why it's divided up the way it is.
- 5:11How people sort of present themselves across space, how cultures interact with the physical
- 5:17sciences.
- 5:18And somebody who like spent my whole childhood like reading through encyclopedias, it was just
- 5:23the best combination of learning and interests that I could ever find.
- 5:28So without even realizing it, I had never heard of geography before I really got into college.
- 5:34It was amazing.
- 5:35It was perfect for me.
- 5:36And it had this component that was, I think, a bit too lightly touched on called GIS, geospatial
- 5:42information systems that I got exposed to.
- 5:46And I thought it was kind of cool, but I wasn't, again, expecting to make computers a part of my
- 5:51professional career at that time.
- 5:53I was really focusing on environmental policy and water policy, especially.
- 5:57Humboldt County has a lot more rain than the rest of California, and they've built these
- 6:01giant dam systems to bring it down to the Central Valley.
- 6:04And it seemed like there was a huge fish die-offs in 2001, 2002 that were directly attributed
- 6:11to the lack of water.
- 6:12And so I got kind of interested in like, how did they make these decisions to build these
- 6:16dams?
- 6:16Why does this water policy exist?
- 6:18How did they benefit and value agriculture, like sort of profit or cotton that wasn't really
- 6:24making a profit in the Central Valley versus salmon, which could be very valuable where I
- 6:29was from.
- 6:29So I got really deep into those weeds and ended up going into grad school in San Francisco
- 6:35State for geography with a focus on resource management.
- 6:39And that was 2007.
- 6:40Nice.
- 6:41And did you end up with like a lot of data?
- 6:43Do you need a process?
- 6:44You're like, all right, I guess I'm going to have to take out these computers again.
- 6:47I just remember like late nights trying to figure out, like just really struggling with
- 6:52the software and doing some interesting.
- 6:54Also, another interest of mine was wine.
- 6:56And I remember trying to do like a temperature map of Humboldt County because a lot of the
- 7:01organic farming families that I'd grown up with had started growing wine at the time.
- 7:04And I wanted to see like, how does it compare temperature-wise to Napa Valley or to other well-known
- 7:10places?
- 7:11And I just hated the manual data entry that I was doing.
- 7:15And I thought, there's got to be a better way.
- 7:16So those feelings and a couple internships that I got when I got to grad school really
- 7:22led me to value programming.
- 7:25And I felt so stupid with it at first because even though I'd had that experience as a child,
- 7:31it had been a decade since I'd really touched a keyboard that way.
- 7:34And I felt like there's got to be something to this.
- 7:38So I'll just keep hitting my head against the wall.
- 7:40And even though I feel kind of dumb, I know that I can use this.
- 7:43And it really worked out.
- 7:44Yeah, that's super cool.
- 7:46I think it's really interesting in your story about how you kind of like slowly just dragged
- 7:51you in.
- 7:51And then you're like, fine, fine, you've got me.
- 7:54I kind of went down the same path as you in some regards in that I didn't really see myself
- 7:59as a developer.
- 8:00I kept looking to do other things, chemistry and math and so on.
- 8:04And eventually I just like, you know what?
- 8:05Actually, I do like this better, but it's easy to forget those early days of like fighting
- 8:10with the syntax.
- 8:11Just, yeah, I remember being so excited about getting a C++ program to compile a little bit
- 8:17right now.
- 8:17It's going to have to run and work correctly.
- 8:20That's the hard part.
- 8:20Not the compiling, but these early days.
- 8:22Yeah.
- 8:23You step over these challenges and then they're kind of in the past.
- 8:26But yeah, everyone goes through them.
- 8:27Well, I remember when I was really trying to learn in 2008, I took a class that was sort of
- 8:32an elective offered through the computer science department.
- 8:34And I got to be really good friends with the guy who was just a master's in engineering student
- 8:39himself.
- 8:39And he really saw that I cared, even though I didn't know anything, basically.
- 8:43And so he spent some time and taught me a bit of Django at that time, which was just coming
- 8:48out.
- 8:48And I remember getting so excited when I was able to have Django use ArcPy, talk to a shapefile,
- 8:55get a location out and put it on a browser.
- 8:58Just like a little tiny thing.
- 8:59Yeah.
- 9:00I showed my grandmother.
- 9:00I'm like, grandma, I did it.
- 9:02She had no idea what I was talking about.
- 9:06I bet she was really happy to see it though.
- 9:09She must've been psyched.
- 9:10She didn't discourage me.
- 9:11She was so excited.
- 9:12But I just remember that moment of just like, I did it.
- 9:15And the wizardry of that.
- 9:17I still don't think I'm over that, really.
- 9:18Yeah.
- 9:19No, I haven't gotten over it either.
- 9:21It's amazing.
- 9:21And just that feeling of I built something that could be useful to people and it's out there
- 9:25and they can play with it and then to see them come and use it is just amazing.
- 9:29I started just that same process of like, whatever I could do at work.
- 9:35Because at this point I had gotten a job as a GIS technician.
- 9:38I was making maps of a park district lands that they were considering adding.
- 9:42And I found it great to be paid, especially during the recession there.
- 9:46But I was not like loving the work itself.
- 9:49So I found all kinds of ways to use Python to automate, to figure out how to make like a database of all the other maps we had made to just anything that I could think of that was interesting to me.
- 9:59I'm never going to enter a map a second time.
- 10:01Yeah, exactly.
- 10:02Stupid map.
- 10:04So and then somewhere in there, I got a call from a recruiter.
- 10:08I had some friends of friends who were in the program who knew that I did some Python and they recommended me for a job at an environmental consulting firm called ICF.
- 10:17And the recruiter, I remember him saying like, do you really want to work for the government?
- 10:20You know, you're like 27, right?
- 10:22Yeah, I suppose you're right.
- 10:25I was so happy to just have a steady job at that point that I wasn't actively looking, but there was some pull to just something different and exciting.
- 10:32And I really benefited because it brought me into the opportunity to work on big environmental projects like the high-speed rail project and figure out how to use Python to automate those.
- 10:43Because we were getting engineering outlines in AutoCAD and we had to convert that into GIS formats and then run that against all of the data we had on species range.
- 10:55Or any kind of protected resource, even like farmland or wetlands or anything like that.
- 11:01And we had to do it week after week after week.
- 11:03And I was kind of, I just remember that first call when I first got hired where I was like, I think I can automate this.
- 11:09Yeah.
- 11:10With that upward tilt in my voice, but I could.
- 11:14And I did.
- 11:15That's awesome.
- 11:16I kind of became a team.
- 11:17And they probably saw you, like you said, as a wizard.
- 11:19They're like, Silas can make it do it automatically.
- 11:22Do you understand what that means?
- 11:24On its own, right?
- 11:25Like not other people.
- 11:26Yeah.
- 11:26And some of the libraries we're going to talk about in GIS are like, hey, I've got this lake and I've got this other thing.
- 11:32Do they intersect?
- 11:33Or does this line pass through this area?
- 11:37And really interesting stuff that builds on common libraries that people will know like SQL.
- 11:41Well, exactly.
- 11:42You know, the one big one that really got me at that time, because I was running into like licensing issues with the Esri ArcGIS software that we were running, couldn't really do some of the higher level analyses I needed to do.
- 11:54So I heard about this thing called PostGIS, which was built on top of what is it?
- 11:58PostgreSQL and then a library called PsychoPG2 that allowed me to write spatial SQL and directly talk to a database and do those analyses in code like I had never been able to do before.
- 12:11And it kind of blew my mind.
- 12:12This is around 2010, 11 or something.
- 12:15That's when I realized like beyond the world of the software that they had given me, this Esri software, there was this incredible open source software community that was providing tools that exactly the ones I needed.
- 12:28And I can tweak them and do so much more and so much faster.
- 12:32Yeah.
- 12:32So interesting.
- 12:33And you don't have to ask for licensing or worry about that or whatever.
- 12:39This portion of Talk Python To Me is sponsored by Linode.
- 12:41Simplify your infrastructure and cut your cloud bills in half with Linode's Linux virtual machines.
- 12:46Develop, deploy, and scale your modern applications faster and easier.
- 12:50Whether you're developing a personal project or managing large workloads, you deserve simple, affordable, and accessible cloud computing solutions.
- 12:58As listeners of Talk Python To Me, you'll get a $100 free credit.
- 13:01You can find all the details at talkpython.fm/Linode.
- 13:06Linode has data centers around the world with the same simple and consistent pricing regardless of location.
- 13:11Just choose the data center that's nearest to your users.
- 13:14You'll also receive 24-7, 365 human support with no tiers or handoffs regardless of your plan size.
- 13:21You can choose shared and dedicated compute instances,
- 13:24or you can use your $100 in credit on S3 compatible object storage,
- 13:28managed Kubernetes clusters, and more.
- 13:31If it runs on Linux, it runs on Linode.
- 13:34Visit talkpython.fm/Linode or click the link in your show notes,
- 13:38then click that create free account button to get started.
- 13:41All right.
- 13:44Before we get off this sort of intro topic, though, really quick,
- 13:46what are you up to these days?
- 13:48You've got a pretty interesting job working with an intersection of a lot of these concepts.
- 13:52Well, yeah.
- 13:53So, you know, that sort of like do-gooder mentality has never really gone away.
- 13:57And I've worked on some big enterprise systems for a whole city, let's say,
- 14:02which included creating a GIS for the Super Bowl for Levi's Stadium when it was here.
- 14:08I got to go to the Super Bowl.
- 14:09We did every concert and event for two years before that.
- 14:12So, I saw Beyonce, you know, I saw Taylor Swift or all these people, right?
- 14:18Just because I built a mapping system that used Python to talk to a 911 database to locate calls that were coming from the stadium.
- 14:25And also, we figured out how to put an iPhone app in the pocket of the police so that we could see where they were.
- 14:30And we could keep 70,000 drunk people from beating themselves up, you know?
- 14:35And so, there was that.
- 14:37But then, like, after that, I felt like I really wanted to just kind of go even more into front-end development and learn more JavaScript.
- 14:44So, I ended up joining a team at NIO, which is, they've, like, shut down their U.S. operations, but it's a Chinese electric car company that's working on automatic cars and self-driving cars.
- 14:56And that sparked a lot.
- 14:58And that team that I worked with, I did leave and go to Zillow, which I'll get to in a bit.
- 15:02But that team that I worked with, I loved.
- 15:04And that team, one of the main guys, Josh Butler, founded this company, Kinetic Eye, which is, I think, the biggest realization from NIO, from all the work we did, all these smart people we worked with, is that,
- 15:14self-driving cars is so hard.
- 15:17And so, using computer vision, using machine learning, without, like, a really directed mission is going to be an incredibly hard thing to master for the next decade or so, even if you spend $10 billion on it.
- 15:30I honestly can't believe we have self-driving cars.
- 15:33It's, I always thought of the AI realm being like, oh, yeah, we're going to do this Turing test, and you're going to have the app chat with somebody over text.
- 15:42And then, if it seemed real enough, your AI is, like, real.
- 15:45And somehow, that always felt so shallow and fake.
- 15:48And then, it was somehow kind of stagnated there.
- 15:50And then, all of a sudden, cars are driving themselves around at a level of complexity so far beyond that they don't even compare, right?
- 15:58And somehow, we couldn't quite get one, and we got this other.
- 16:00I mean, yeah.
- 16:02Tesla just rolled out their beta, right, last week or something.
- 16:05Yeah, exactly.
- 16:06It's advancing all the time.
- 16:07I still felt like it was a huge problem, and level four, level five self-driving cars, which we were working towards, was going to be a decade off.
- 16:15So, this team that split off, we're focused on computer vision in small spaces, in warehouses, to see, like, how safe are people being?
- 16:23How much risk are people causing with their driving habits or with their work habits?
- 16:28And how can we give business owners the ability to understand how safe the practices are at their work?
- 16:35How much potential risk they have for, like, a worker's comp or an injury?
- 16:39And the do-gooder in me loves it because, like, injuries just ripple out throughout a community.
- 16:44If somebody is hurt, then they're out of work for a while.
- 16:47Then their family is hurting.
- 16:48Then their community is hurting.
- 16:49And we really want to, like, have this use of computer vision that identifies intelligently risk and safety.
- 16:59And so, it's a cool mission and also great technology.
- 17:01Yeah.
- 17:02So, if I had a factory and maybe after lunch, people would come back and they weren't putting on their hard hats.
- 17:07Yeah.
- 17:07Or something like that.
- 17:08You would say, like, ah, we're missing some hard hats?
- 17:10Something like that?
- 17:11Yeah.
- 17:11Yeah.
- 17:11Yeah.
- 17:12Hard hats, vests, masks.
- 17:14Social distancing was one we built right away, obviously, when COVID hit.
- 17:17Oh, yeah.
- 17:18Of course, yeah.
- 17:19And then forklift speeding, forklift near misses is really cool because we're able to plot it on a map, you know, like, brings it back to the map.
- 17:26So, all those insane, like, YouTube videos of, like, people crashing, doing stupid stuff on, like, you know, work just after hours.
- 17:34Like, you would know about that kind of stuff?
- 17:35Yes, exactly.
- 17:37You know, we're working towards, like, a real-time notification.
- 17:40I think that that's in our future.
- 17:41But more than anything, it's the all-the-time risk environment that we want to let people know about.
- 17:47Like, how well are you doing and how safe are your people?
- 17:49Sure.
- 17:50Yeah, that sounds like a great mission.
- 17:51Let's talk broadly about GIS for the moment.
- 17:55Just some of the areas which have been used.
- 17:57I mean, we talked a little bit about this with some of the environmental things you talked about.
- 18:02I mean, I guess one of the things that most starkly stands out for me, maybe two, is one, is directions.
- 18:08Like, another thing that I'm just blown away by.
- 18:11Yeah.
- 18:12And also, probably, like, a little bit weakened by, just as a human, is GPS.
- 18:16The ability to ask Google Maps or something else how to get me there.
- 18:20And just, I'm thinking of the feeling I have when I, for some reason, forgot my phone or the battery dies.
- 18:26I'm just like, oh, I'm done.
- 18:28Yeah.
- 18:28What's going to happen now?
- 18:29I have no GPS.
- 18:31Right?
- 18:32Whereas, like, I grew up without even a cell phone.
- 18:34So, it's just such a weird thing.
- 18:36But absolutely GPS, right?
- 18:37Well, 20 years later, it's just become part of our lives.
- 18:40Like, I remember in, like, 2001, let's say, trying to drive through San Francisco and being so freaked out, driving probably the longest way I could because it was the only route I knew to get safely from one side to the other.
- 18:52And just couldn't imagine, you know, how easy it is today.
- 18:56I went and visited my uncle who had gone to the Naval Academy.
- 18:59And he was living in Annapolis in, like, 2005.
- 19:02And I had some friends in D.C.
- 19:04And I said, I'd like to go visit them.
- 19:05How do I get down there?
- 19:06And he's like, oh, well, there's GPS in my car.
- 19:08So, you can just take my car.
- 19:09And it will just tell you how to get there.
- 19:10And I couldn't believe it.
- 19:11It was just the easiest trip I'd ever had, door-to-door, in an area I had never visited in my life.
- 19:17It blew my mind.
- 19:17Yeah.
- 19:18It's so amazing.
- 19:18I remember doing some work in Shanghai.
- 19:20And I had one of the early iPhones.
- 19:22And I was using Google Maps.
- 19:24I had gotten into the habit of, I'd sort of pick a random orientation.
- 19:27I'm going to go that way for about an hour, walking and exploring.
- 19:31And when I get tired, I'm going to just hit, take me back to my hotel.
- 19:33And I had gotten really far one day.
- 19:36And the phone was down to, like, 10%.
- 19:38And I'm like, oh, my God.
- 19:39I forgot the name of my hotel.
- 19:41And I can't speak Chinese.
- 19:43I can't speak Mandarin.
- 19:43I'm going to be in really big trouble.
- 19:46So, I had to just turn it off.
- 19:47I'm like, please turn back on and get me close.
- 19:49You know, like, that was the most extreme concern of lacking GPS.
- 19:53But, yeah, certainly those things are amazing.
- 19:55Another area that I think is really probably interesting,
- 19:59and maybe actually has a little more personal touch for you is agriculture, right?
- 20:03Like, understanding your crops and growing things.
- 20:05And just, you know, you think of sort of the idyllic farmer with just basic tools, right?
- 20:10But there's a lot of IoT and a lot of smarts you can apply to those things now.
- 20:15The marriage of GPS and GIS and farm tech is just all over, especially, let's say, the Midwest,
- 20:22where they have, you know, one of the first self-driving applications was tractors, right?
- 20:26Because it's so boring to just be in a tractor for a straight line for a long, long, long time and then turn around, right?
- 20:31So, they figured out how to make the thing turn around using a satellite.
- 20:34And it's pretty impressive.
- 20:35I've always thought, too, that even, like, down to the small organic farms that I grew up with, you know,
- 20:40where you're incredibly resource-specific, you need to know exactly what went where and keep track of it, you know, for regulations.
- 20:47But also just to know what to grow next and to keep track of your nutrient levels in your soil,
- 20:52that GIS and mapping would be a really great use.
- 20:56I'm not sure how far it's gotten into there because a lot of them are kind of old-school hippies who don't, you know,
- 21:01they still use pen and paper as much as possible.
- 21:03But it's...
- 21:04Maybe if you tell them it's open source and it's not corporate, they might accept it a little more.
- 21:07They might love that, yeah.
- 21:08So, yeah, it's become incredibly important.
- 21:11And, you know, like just monitoring water levels, for instance, like, what do they call it?
- 21:17NDVI, which is like how you can see how well your crops are watered or thriving
- 21:22based on, like, the infrared that you can't see from the satellite imagery we can get now.
- 21:27It's just incredible revelation, you know, and seeing that.
- 21:30Yeah, I can imagine.
- 21:31Yeah.
- 21:31But then, you know, I kind of pulled away from that when I came down to the city
- 21:35and got more into, like, environmental services, environmental industry.
- 21:39And the two biggest projects I worked on was the high-speed rail, as I mentioned.
- 21:42And then also the PG&E has power lines everywhere.
- 21:46That's caused some issues because there's branches that have rubbed up on it and fires have started.
- 21:50They have programs that monitor how much trimming they do around all of their lines throughout
- 21:56all of Northern California, and they keep track of it.
- 21:58And then they also have to kind of estimate within all that work how many, you know, endangered
- 22:02species they stepped on accidentally, that kind of thing.
- 22:05And because it's something that is expected work, they have to mitigate.
- 22:09So, we would use GIS to calculate basically how much PG&E needed to pay.
- 22:14The impact.
- 22:14Yeah, the impact.
- 22:15That was really cool.
- 22:17The species animal equivalent of a carbon tax or carbon offset or something like that, right?
- 22:22Yeah, pretty much.
- 22:24Yeah.
- 22:24It's just kind of how it goes.
- 22:25The thing is, if they don't trim those lines, I mean, those fires are horrible this year.
- 22:32And, you know, it's not like you could say, well, you just shouldn't trim them, right?
- 22:35It's going to be worse, right?
- 22:36It's like a necessary evil, basically.
- 22:38Yeah, you have to do it.
- 22:39I don't want to say I got disillusioned, but I realized in some ways that the industry
- 22:43is, it's sort of just like insurance.
- 22:45It's something, an expected business payment that you have to do to cover the effects of
- 22:50your business, especially for those giant utilities or other large construction projects, which
- 22:55is fine.
- 22:56It maybe dampened my enthusiasm a bit.
- 22:58But really, at that point, I was really getting excited by the technology.
- 23:02It turns out I really like programming.
- 23:03And I decided to move on to a company that was focused on city, like city GIS, like enterprise
- 23:12GIS, being able to integrate, you know, the police with the sewers, with everything.
- 23:16Because when we got there to that city, which is Santa Clara.
- 23:19Basically building the smart city.
- 23:20Smart city.
- 23:21Yeah.
- 23:21You know, they had like 11 different address databases that they were using.
- 23:25Each department had their own and they were all different.
- 23:27So like, imagine the police not knowing when you're at where your address is.
- 23:31Well, it's more common than you would think, unfortunately.
- 23:34Right.
- 23:34And smart cities really appealed to me.
- 23:37So I spent a couple of years doing that.
- 23:39And that was amazing work.
- 23:41But I just, again, really liked the programming so much.
- 23:44I started moving away probably from pure GIS into a lot of like front end stuff.
- 23:50But that kind of gave me an opportunity to get to know web mapping and JavaScript and all
- 23:55the amazing JavaScript tools that have come out over the last 10 years to enable mapping
- 24:00on the web.
- 24:00Yeah.
- 24:01So you worked at Zillow, for example, which is pretty awesome.
- 24:04Yeah.
- 24:04Zillow is definitely one of those cutting edge companies.
- 24:06I remember being blown away when Zillow, when I first experienced Zillow, I'm like, I could
- 24:11see what my neighbors paid for their house.
- 24:13Yeah.
- 24:14And the value, predicted value of it now.
- 24:16And just like all that sort of neighborhood-y stuff.
- 24:20Really interesting.
- 24:21Yeah.
- 24:21Well, when Zillow came out in like 2005, let's say, Esri really dominated the GIS space.
- 24:28But you started to see these little cracks appear where like mashups, as they called them in the
- 24:33late aughts.
- 24:34That's right.
- 24:35That was the web 2.0.
- 24:36Yeah.
- 24:36Mashups.
- 24:37Mashups.
- 24:37That was all the hype.
- 24:38And in reality, you know, Zillow is just still a mashup.
- 24:43It's a map with a data overlay of parcel information and some machine learning predictive algorithms,
- 24:50I'm assuming, that go into the values, the Zestimates that you see.
- 24:54Yeah, those estimates.
- 24:55That's right.
- 24:56So, it was really cool.
- 24:57And what we were focusing on, or at least what I was brought in to focus on as the geospatial
- 25:01lead there, was mapping every single neighborhood in America and Canada to understand like how
- 25:07people defined the space around them.
- 25:09Because again, for me, in some ways, the geography was more important than the code itself, per se.
- 25:14It was.
- 25:15Yeah.
- 25:15Yeah.
- 25:15And it got really cool, but that project was canceled to focus on other big projects.
- 25:21So, I got into data pipelines and I did actually a lot of Spark work, some PySpark, but also
- 25:29using Scala.
- 25:30I did a little bit more Scala.
- 25:31So, I cheated on Python there.
- 25:32That's for a different podcast.
- 25:34But yeah, like it was amazing work.
- 25:38And it is still though, in some ways, like web 2.0.
- 25:41And I kind of wanted to really be a part of the future.
- 25:45I really be a part of whatever this wave is.
- 25:47Is this 2.3.0, 4.0, 10.0?
- 25:50I don't know anymore.
- 25:51More.
- 25:514.0.
- 25:52But I think that that's having worked at NEO right before that and seeing what was going
- 25:57on there with the self-driving and the computer vision, which is fascinating stuff.
- 26:01And just my experience with computer vision actually comes from GIS because classification
- 26:05of data, of satellite data is a big part of GIS.
- 26:08There's this division between like vector and raster data and the raster data coming out of
- 26:14satellites.
- 26:15You got to look at the pictures out of the satellites and make some sense of it.
- 26:18Is that a river?
- 26:18Is that a lake?
- 26:19Is that a car?
- 26:20It's incredible.
- 26:21Just to be able to make these colors, these cells next to each other and make sense of
- 26:25it.
- 26:25It's incredible.
- 26:26It really is.
- 26:27And it still blows my mind in some ways.
- 26:28So it was a natural move to go into computer vision.
- 26:33And what I really realized recently is that it's not that different.
- 26:36We have this video data that we're overlaying all kinds of information about what you're seeing
- 26:42and you're interacting with it.
- 26:44It's a different kind of map is what it is.
- 26:46Yeah.
- 26:46Yeah.
- 26:47You know, I want to just dive in that for a second because I think it's so interesting
- 26:50how much these skills that we develop and these things you feel are so specific to some
- 26:56particular area, right?
- 26:57Like GPS or something like that.
- 27:01My experience from going around and doing, I used to do in-person training classes.
- 27:05I remember I was one week working at Edwards Air Force Base.
- 27:08Then I was working at like a hedge fund in New York the next week.
- 27:12And I'm just like, these cannot be more different.
- 27:15These groups.
- 27:16And what I realized was I was teaching them basically the same thing.
- 27:19And they both needed it exactly.
- 27:21They both needed a lot, right?
- 27:24And it's like, there's this sort of core of what you need to be super good at all these
- 27:28ideas.
- 27:29And I suspect in the GIS realm, it's kind of similar, like the computer vision, the ML,
- 27:34the database, you know, geospatial queries and all those kinds of things.
- 27:38Like everyone just needs that.
- 27:39And then it's like that little 20% difference that goes on top.
- 27:42It seems like it's the whole difference, but it's just a little bit, right?
- 27:45Totally.
- 27:45Yeah.
- 27:46I guess we both chose wisely in that Python became our focus because it incorporates all
- 27:52of those things and very nicely, by the way, I think.
- 27:55And I really do think that, yeah, it's not that different.
- 27:59And it is so cool to be able to just get this basic of programming, the basics of programming
- 28:05and whatever you're passionate about.
- 28:07And you can just take that across fields and feel really successful and useful.
- 28:11Yeah.
- 28:12Yeah.
- 28:12It's super cool.
- 28:13I totally have seen it happen over and over.
- 28:15And I just want to highlight it because I know there's a lot of people out there listening
- 28:18or knowing that would be really useful, right?
- 28:20Like they probably feel like they're struggling to just make it in one area, but really that's
- 28:24actually, that's the whole, that's everything.
- 28:26Almost all of it, right?
- 28:27It's cool.
- 28:28Somebody said one time that what's he, like, it's amazing being a developer, but it's even
- 28:32cooler in some ways being like, let's say a chemistry person who knows how to program,
- 28:36you know, or for me, like environmental or water policy, knows how to program.
- 28:40All of a sudden you're so valuable in that office.
- 28:44They can't believe they live without you.
- 28:45And it's not that different from other types of programming, really.
- 28:49It's just data that you're manipulating.
- 28:51A lot of ETL, right?
- 28:52That's, that's kind of a lot of what we do.
- 28:54And that's awesome.
- 28:55It's so fun.
- 28:56I agree.
- 28:57All right.
- 28:57So let's actually next spend a little time talking about some of the libraries and whatnot
- 29:02that might be worth thinking about that are out there, the types of problems we can solve
- 29:07with them.
- 29:07So you spoke about Shapely already.
- 29:09Maybe give us a quick rundown on Shapely again.
- 29:11Yeah.
- 29:11There's a team, I suppose, but headed by this one programmer.
- 29:15I forget his name right now.
- 29:17I think it's Sean.
- 29:18But anyway, Shapely and Rosterio are pure Python tools for manipulating geospatial data.
- 29:25Shapely is more about once you've read in the data into your code somehow, then you can perform
- 29:32distance analysis or you can say, you know, is this car in this neighborhood?
- 29:37How far has this car traveled?
- 29:39How close was this car to this particular house?
- 29:42All those questions that you might need to ask, or you might, you know, calculate demographics
- 29:47across space.
- 29:48Anything that you need to do with polygons, points, and lines, which is the majority of
- 29:53vector data, you're able to do with Shapely.
- 29:56And it's very useful in that sense.
- 29:59It has a really nice interop between JSON as well.
- 30:01Yes.
- 30:02Super nice.
- 30:03Right?
- 30:03Yeah.
- 30:04You can store your data in JSON like it just naturally reads and writes that.
- 30:07Yeah, exactly.
- 30:08There's a format called well-known text as well that it reads.
- 30:10So it's very smart in that sense.
- 30:12And Rosterio or RosterIO, I always get that confused, is the Roster, Raster, Roster version
- 30:18of that.
- 30:18I always say Roster, maybe it's Rester.
- 30:20But the other one I really like that you have here is GeoAlchemy 2, which is an add-on
- 30:26to SQLAlchemy, which is amazing just in itself.
- 30:30Like SQLAlchemy is so cool to be able to write code for any particular or general database and
- 30:36then be able to have the code work is incredible.
- 30:38I really like ORMs.
- 30:40I love ORMs too.
- 30:41And I think that they just make data so much more accessible and remove some of the error,
- 30:47potential error that you might have in working with it.
- 30:50Right?
- 30:50Like if I'm going to insert something, I don't forget to add this other part of it.
- 30:53Right?
- 30:53This piece of data.
- 30:54Or you might, you know, when you load it up, you might forget to convert some value from
- 30:59a string to an end or who knows.
- 31:01But right?
- 31:01Like you build these classes and it just, you do a few simple things and you've got a really
- 31:07legit app working with a database.
- 31:09Yeah.
- 31:09And so that's SQLAlchemy, obviously, right?
- 31:11And Django has its own version, but if you're not doing Django, basically you're probably
- 31:15using SQLAlchemy, which has been going strong.
- 31:18So GeoAlchemy, what's the story of that?
- 31:21It is specific to PostgreSQL with the PostGIS spatial engine add-on, but it allows you to,
- 31:27as you're saying, just write a database model that includes geospatial columns.
- 31:34So the columns that store these points, lines, and polygons that we're describing.
- 31:38And you're able to do with that module, all of these different buffers or intersections
- 31:44or any other kind of geospatial analysis that you need to do directly with the data that
- 31:50you're storing in your database.
- 31:51Nice.
- 31:52So if anyone's familiar with SQLAlchemy, it's exactly the same.
- 31:55Like you create a declarative base, you create an engine, you do the create tables, like all
- 32:00that stuff that you do, you create a session and you add stuff to it.
- 32:03So like all those are the same, but you can have interesting stuff.
- 32:07Like you could define a class, which is a lake, for example.
- 32:10And it's got a primary key, which is an ID.
- 32:13It's got a name, which is a string, but then it could have a geometry, which is a polygon,
- 32:18which is one of these things coming out of GeoAlchemy, right?
- 32:21Yeah.
- 32:22Well, GIS, yeah.
- 32:23In general.
- 32:24Yeah.
- 32:24Yeah.
- 32:25Yeah.
- 32:25Exactly.
- 32:26So you just create, like, it's just a different column type out of that library.
- 32:29Yeah.
- 32:30And yeah, you're out to the races.
- 32:32There's always a weird idea within GIS that, like, is spatial special data?
- 32:36Are we specialists or are we tech people?
- 32:39Like, there's always kind of a weird nebulous feeling there.
- 32:41And what it does in some ways is it makes spatial data not special.
- 32:45It makes it really easy to deal with.
- 32:47It's logical and stored exactly like any other data in a column.
- 32:51Associated features are right there in that same row.
- 32:54And you can do relationships with it, like just like an ID-based relationships.
- 32:59But you can also do spatial relationships.
- 33:01You can say, given this neighborhood, how many homes above this age or this price, let's say,
- 33:07exist in that neighborhood?
- 33:09You know, that kind of query.
- 33:10Yeah.
- 33:10And you can just treat it like just any other data, but there's just this couple of special
- 33:15tweaks that allow it to be really flexible.
- 33:17And it's just more database queries, just like the session.query of, like, lake filter.
- 33:22And then it's like, excuse me, the geometry contains this point or it intersects this line.
- 33:28And presumably those are done with, I guess, some form of an index.
- 33:33So that's fast.
- 33:34Yes.
- 33:34I don't really know, right?
- 33:35There's spatial indexing that improves it quite a bit.
- 33:38In fact, with the right engine underneath your database, these queries go fast for millions
- 33:43of points.
- 33:43Postgres is pretty, pretty amazing for being a free digger.
- 33:46It's pretty awesome.
- 33:47Yeah.
- 33:48Yeah.
- 33:49Yeah.
- 33:49It is super cool.
- 33:50You know, we were talking a little bit about it earlier.
- 33:52Like Tinder, you know, all these modern apps are geospatial because they've just integrated,
- 33:58you know, where you are, where are the object that you're interested in, or like Uber.
- 34:02Like, you know, nobody understood what I was saying when I said GIS.
- 34:04But when I finally was like, oh, it's like Uber, you know, you see where you are and you see
- 34:08the car coming to you, which is...
- 34:09And you see the roads where it can go and maybe even optimize a path if it's like a
- 34:14shared Uber, whatever that is called.
- 34:15All of those are geospatial.
- 34:17Sure, they don't share anymore, but they used to.
- 34:18I know, right?
- 34:21Yeah.
- 34:21They used to work together when they had to.
- 34:23Yeah.
- 34:24So it's built into our modern lives in ways like you were talking about mapping, you know,
- 34:28but it's mapping plus information overlay and sorting through that information to find the
- 34:34things that are interesting to you across a varied and unique space that you may not be
- 34:39familiar with.
- 34:39A new city.
- 34:40Yeah.
- 34:40Yeah.
- 34:41Well, when you were first talking about studying your master's degree in geography, just thinking
- 34:48back of when I was in middle school or something, I was like, well, what you're going to have
- 34:51to do is name all the states in the US.
- 34:54You have to name all the countries in Europe.
- 34:55Like, okay, well, not super interesting, but I guess I'll like, I'll commit that to memory
- 35:00and we'll just, we're going to do this, right?
- 35:01And then probably forget most of them.
- 35:03And, you know, that's kind of was my like young mind's impression of that.
- 35:07Yeah.
- 35:07But, you know, if you think of like space overlaid with flowing data and all the questions
- 35:12and answers that you have, all of a sudden it becomes this really interesting programming
- 35:17problem and a really important for people's lives.
- 35:19Well, let me have a quick diversion here.
- 35:22So back in the thirties, especially there was a lot of geographers hired to like make flood
- 35:26maps or other kinds of maps.
- 35:28They were trying to figure out like, where are disparities across space and how can we help
- 35:31people?
- 35:31And it was a top level science.
- 35:34Geography had departments all across like Harvard, Yale, all of those schools.
- 35:38But then to be honest, there was like a supposed like homosexual scandal at one of these schools
- 35:44where like, you know, a geography professor was living with one of his grad students and
- 35:48president who had skepticism around the science itself kind of decided just to cut it out.
- 35:54And because like he gave a different reason for it, but that was the rumor behind it all.
- 35:59Oh my gosh.
- 35:59Yeah.
- 36:00So it was Harvard or Yale.
- 36:01They cut it out.
- 36:02And then all the other top IVs followed.
- 36:04But in most other countries, geography is a top level study because you're really understanding
- 36:09like, why are these people suffering from pollution more than these people next to them?
- 36:13What are the prevailing winds?
- 36:15What are the reasons that they live there?
- 36:16What are the historical, you know, why were black communities affected by freeways in the
- 36:21seventies more than other communities?
- 36:23You know, it was partially their political power, partially where they were living because the
- 36:27elevation was flatter and it was more prone to floods.
- 36:30There's just all these geographic questions that are kind of amazing to study and you can
- 36:34get hyper-specific with it, but didn't appeal apparently to these top level schools until
- 36:39around 2005 when Harvard started its spatial library.
- 36:43And that was like a GIS focused library.
- 36:46And they brought back geography or at least some component of it that was tangible to them.
- 36:50Oh, wow.
- 36:51Yeah.
- 36:51I had no idea about that history.
- 36:52Nobody does.
- 36:53It is sort of a unique component to this like science.
- 36:57That's everywhere and nowhere.
- 36:58No pun intended, really.
- 37:00Yeah, absolutely.
- 37:01So we talked about geo-alchemy.
- 37:03There's a geo-alchemy there.
- 37:04It's called geo-alchemy 2.
- 37:06What happened to 1?
- 37:07Or no suffix.
- 37:08Do you know?
- 37:09Go straight to 2.
- 37:10You know, whoever started 1 abandoned it and somebody else took it over.
- 37:15Yeah.
- 37:15Yeah.
- 37:15But they didn't want to edge it out or say, all right, we'll call it 2.
- 37:17Yeah.
- 37:18If we're in Django, we have geo-django.
- 37:20That sounds better.
- 37:22Geo-django.
- 37:22Sounds fun.
- 37:23But maybe it's got to live within the Django models and stuff like that.
- 37:27Yeah.
- 37:27Obviously, if you're using Django, you probably would consider that.
- 37:30It's actually right built in.
- 37:32You just have to import one more thing in your admin.py.
- 37:34I believe that's what it's called.
- 37:35Or I haven't used geo-django in a few years.
- 37:38But it's like, you know, right from the get-go, when Adrian and his buddy were designing Django,
- 37:43they were doing the EveryBlock project that they ended up selling to CBS, which was kind
- 37:48of like a citizen app in 2007 where they were saying, like, here's what's happening on every
- 37:53block in America.
- 37:54And so, geography was built in early into Django.
- 37:57Oh, interesting.
- 37:58I had no idea about that history.
- 38:00Yeah.
- 38:00I mean, Django comes out of newsrooms, right?
- 38:03Yeah.
- 38:03It came from the lore and internal world or something like that.
- 38:06So, it makes total sense that it would have that, some of those ideas in there.
- 38:10Yeah.
- 38:11As soon as he left, Adrian, I forget his last name right now.
- 38:14Anyway, he started EveryBlock and I think he did well selling that.
- 38:17It was like a huge part, as you said, and it's very much related to reporting.
- 38:21So, I was like, yeah.
- 38:22I'm more into Flask these days, which it's just kind of simple and you can just add what
- 38:27you need when you need it.
- 38:28No disrespect to Django.
- 38:29Django's fantastic.
- 38:30Yeah.
- 38:30So, if you're in Flask, GeoAlchemy too, obviously, right?
- 38:34Yep.
- 38:34But if you're in Django, probably you just use the features that are
- 38:36built straight into it, right?
- 38:37Tons of tutorials about it all around.
- 38:39Yeah.
- 38:40It was well supported.
- 38:41Yeah.
- 38:41So, you have some that are on ArcGIS, which is the Esri commercial package, which they actually
- 38:48do a ton with Python as well over Esri, which, so if you're doing Python, you might, it might
- 38:53still be a great place to be, but it's also, you know, something you pay for.
- 38:55So, you might alternatively consider some of the piecing together things from some of the
- 39:00open source tools, right?
- 39:01But yeah.
- 39:01So, tell us about your books.
- 39:02Sure.
- 39:02Yeah.
- 39:03I got the opportunity, having volunteered to review some books in like 2012, an early
- 39:09open source Python GIS book.
- 39:11It was great.
- 39:12And I was on PAC Publishers list and they kept emailing me like, can you write a book about
- 39:16network security and Python?
- 39:18And I was just thinking, no, I can't.
- 39:20I don't know anything about that at all.
- 39:22How about cutting edge cryptography?
- 39:23Have you done that?
- 39:24Yeah.
- 39:24Exactly.
- 39:24I also know.
- 39:25Sounds like you've got the same emails, huh?
- 39:27Yep.
- 39:28So, I finally wrote back to them.
- 39:30I was like, look, I am a GIS professional and I can write about that.
- 39:34If you have any interest, let me know.
- 39:36Otherwise, stop emailing me.
- 39:37And they said, yeah, actually we do.
- 39:39So, they recruited me to write a book on ArcPy, which was at that point about five years old,
- 39:45but it was just getting more and more prominence.
- 39:47And I was obviously an early proponent.
- 39:49And I wrote that first book, ArcPy and ArcGIS, Geospatial Analysis with Python, which we did
- 39:56a second version of me and my coworker, Dara.
- 39:58And that one focused more on the newer ArcGIS Pro, which uses the Python library for that as
- 40:05Python 3.
- 40:05The problem with ArcPy is it's Python 2 based.
- 40:08So, it'll be supported for a while in terms of Esri, but the greater Python world is rapidly
- 40:14leaving it behind.
- 40:15Yeah.
- 40:15There are some interesting industries that kind of get stuck.
- 40:18They so embrace Python, but they embrace it in a way where they package it into their tooling.
- 40:24And I'm thinking of the movie and entertainment workflow industry.
- 40:29There's all these tools like Maya and whatnot that have Python built in.
- 40:32And a lot of them embedded the Python 2 runtime.
- 40:36And they're just, until they as a group decide to change, they're like, that's how it is,
- 40:41you know?
- 40:41Yeah, exactly.
- 40:42You know, Esri keeps trying to retire its ArcMap product in favor of this new ArcGIS Pro.
- 40:48But it's not going to happen because they have a huge sort of lazy, let's say, no offense,
- 40:53workforce that doesn't want to learn a whole new software.
- 40:56And I totally get it.
- 40:57Yeah, maybe they have stuff that works and they don't consider building those things
- 41:02or maintaining their job.
- 41:03They just need that to work for their job, right?
- 41:06And that's good for them, but it's a tough place to be.
- 41:09They wrote this software called Avenue, which was their original programming language or one
- 41:14of them in the early aughts.
- 41:15And people are still using some of those scripts, I'm sure, in places.
- 41:19So, you know, things stick if they work, just like you said.
- 41:22And it makes sense.
- 41:23Yeah, so you took another take on this.
- 41:25Yeah, and it was fun.
- 41:26I actually recruited some help because writing books is a lot on Twitter and found a couple
- 41:31guys that I follow on Twitter.
- 41:33And we wrote this book, Mastering Geospatial Analysis with Python 3, which is like a 16-chapter
- 41:39review of available modules.
- 41:42Does a pretty good job of going from like very specific geospatial stuff all the way up to big
- 41:47data.
- 41:48And there's a couple chapters in there on interactive web mapping that I wrote around
- 41:52Flask and GeoAlchemy as well as GeoDjango.
- 41:55I thought it was great.
- 41:56We even touched on, do you know what MapD, they became OmniSci.
- 42:00It's sort of a...
- 42:01Oh, I don't know.
- 42:02It's like a GPU database tool that does some pretty amazing visualizations.
- 42:08And they have a Python module, PyMapD.
- 42:11They may have changed the name.
- 42:12Yes, things like that.
- 42:13Like all these incredibly cool modules that just kind of blew me away.
- 42:17We just touched on it really because there's so much to touch on.
- 42:20But I think it's a great book.
- 42:22I really liked writing it and it's so wide.
- 42:24Well, it sounds like it really does a good coverage of all these things if you're into
- 42:28Python plus geospatial.
- 42:29Yeah.
- 42:30Well, yeah.
- 42:31It's not like it's selling like hotcakes or anything.
- 42:34You know, these...
- 42:36Well, not before your appearance on the podcast.
- 42:38Yeah, there you go.
- 42:38Yeah.
- 42:39Yeah.
- 42:39I'll be looking for those checks rolling in, right?
- 42:42That's right.
- 42:43Yeah.
- 42:43I would say it's only 30% like the App Store.
- 42:45Don't worry, I'll be fine.
- 42:46No, just kidding.
- 42:47But speaking of podcasts, you spent close to a year doing a podcast on GIS topics, right?
- 42:55I did.
- 42:56And that was a joy.
- 42:57I mean, it's fun being back here and remembering how much fun this is.
- 43:00My co-host, Todd Barr, who is the spatial punk.
- 43:04He's sort of Esri's aside and the thorn of Esri is sort of his like thing.
- 43:09And, you know, he's just criticizing like the lack of support for big data and just really
- 43:15innovative or any kind of innovation the way he sees it.
- 43:19I think like there's some great tools coming out of Esri like ArcPy and ArcServer is very
- 43:24cool.
- 43:24But he felt like within the realm, they had too much dominance and not enough like push
- 43:29towards really cool, new and fast pipeline supports, especially for big data.
- 43:35So we had a lot of discussions with all kinds of different users, though, around like different
- 43:40focuses, cartography to big data to archaeology.
- 43:44We had a journalist up in my hometown who does like a, it's a Django based website that gets
- 43:50like 3 million hits a month.
- 43:51And they use a lot of GeoDjango to like locate where all the different, say, arrests or accidents
- 43:57happen.
- 43:58They just pull in records from the courthouse and automatically add location to it.
- 44:03It's one of those things like you were saying about just adding in just a little bit of Geo
- 44:07that makes your field, whatever it is, way better.
- 44:10Yeah.
- 44:11I recently did an episode on Python and AI ML in journalism.
- 44:16And there was a lot of geospatial stuff there as well about like automatically understanding,
- 44:20you know, like earthquakes in real time or crime in real time and those types of things as
- 44:27well.
- 44:27So yeah, I think it spans a lot.
- 44:29Have you heard of a hood line down here?
- 44:31Hood line?
- 44:31No.
- 44:32They've gone national.
- 44:33In fact, I think they were purchased by Nextdoor, but it is a journal.
- 44:37It's like a local neighborhood journalism site focused on all kinds of different cities,
- 44:41but it started here actually in the neighborhood.
- 44:43I live in San Francisco in the lower Haight.
- 44:45And it was all about trying to automate a lot of the like exposition within a story.
- 44:51If like a restaurant opened or something, they could tell you about all the other restaurants
- 44:54that opened within a certain radius, that kind of thing.
- 44:56So machine learning and ghostwriting a lot of their stories was a big focus.
- 45:00I thought it was amazing.
- 45:01Oh, yeah.
- 45:01How interesting.
- 45:02That makes perfect sense for Nextdoor, of course.
- 45:04They're trying to like hyper local stuff.
- 45:06Maybe just give us a quick couple of your favorite episodes for your podcast.
- 45:09People, I'll link to the show and people can check it out if they're interested.
- 45:13The cartography one with Sarah Bell was really fun because we talked to her about just kind
- 45:18of, you know, cartography and her GIS career, but also like what it's like being a woman in
- 45:22the field and how she's loved it and hated it at times.
- 45:27That one really resonated.
- 45:28I thought the journalism one was fascinating because, you know, we're talking about all kinds
- 45:32of different crazy stories that they've covered.
- 45:34For instance, they did a, you know, where I'm from, Humboldt County, there's a lot of
- 45:37marijuana up there.
- 45:38And so they did like a comparison with satellite imagery saying like, do you think this satellite
- 45:44has marijuana grown in it?
- 45:45And it pissed off all the locals, but it made for an amazing like application through their
- 45:50website.
- 45:53It's kind of a crazy mix of GIS and crime and reporting, which is just such a fascinating
- 46:00way to approach the world because that's really how things work.
- 46:03You know, things are located somewhere.
- 46:05Yeah.
- 46:05And a lot of those things are affected by the location that you're in, right?
- 46:09Quality of schools, the attitude or predispositions the police might have and perceiving the people
- 46:15in that neighborhood may vary a lot, right?
- 46:18Things like that.
- 46:19Oh, yeah.
- 46:19You know, you can tell these stories with data, right?
- 46:22Yeah.
- 46:22Well, I was, so the CEO of Hoodline, when she brought me on as a consultant, I was encouraging
- 46:27her like, you have to know every gang territory in LA, you know, like that's the kind of thing
- 46:33that would really make for an amazing story, especially for automating it.
- 46:37So we never went that far with it, but I think there's still room to do that.
- 46:40Yeah.
- 46:40I guess there probably would, right?
- 46:42Yeah.
- 46:43So the Mappiest Hour was really fun.
- 46:45And Todd was a great co-host.
- 46:47We're still talking about doing some more maybe next year, but it was a very big year for
- 46:51us both.
- 46:52Yeah.
- 46:52So you had, you had season one and then maybe you could do season two.
- 46:55There you go.
- 46:56Yeah.
- 46:56Well, with this kind of encouragement, I'm loving this.
- 46:59So yeah, maybe I'll just ride this wave.
- 47:01Call them out.
- 47:02It's always fun.
- 47:04Yeah.
- 47:05You're just like sort of a bit of a sidebar with fellow podcaster.
- 47:08Like it's really interesting that the people that you get to meet, right?
- 47:12If there's so many folks that I've spoken to that generally, at least before I got into
- 47:17the podcast, you know, five years ago would have not really bothered to give me the time
- 47:21of day, or at least they wouldn't have been excited about it.
- 47:23Right.
- 47:24And now I, almost everyone I reach out to is excited to be part of the show, to share
- 47:28their story, to talk, and you just get to meet so many interesting people.
- 47:30It's just such an honor to sort of be part of that.
- 47:34Right.
- 47:34It's cool.
- 47:34Oh my God.
- 47:35It really is.
- 47:36I'm loving this.
- 47:37And you must have just so much fun.
- 47:38You're doing this full-time now or?
- 47:40Full-time.
- 47:41Yeah.
- 47:41Two shows a week.
- 47:42Yeah.
- 47:43It's great.
- 47:43Oh, that's great.
- 47:44It's just such a cool dive into who we as developers are, which is much more, much less
- 47:49monolithic than it sounds like initially.
- 47:51And there's just so many different ways and things you can do with code.
- 47:55Yeah.
- 47:55And you touched so much on it when you talked about that person who, not necessarily a CS grad,
- 48:00but some other expertise, but now has the magic programming power that
- 48:04most people don't.
- 48:05And there's just so many interesting stories and use cases and libraries and applications
- 48:10coming out of that side of the world that it's bottomless.
- 48:13It's cool.
- 48:14Just got to grasp what a for loop is and you're well on your way.
- 48:17Exactly.
- 48:18Pip install and you're going to be good.
- 48:19All right.
- 48:21Let's see.
- 48:21One more thing that we threw out to talk about was WebGIS for Flask or Django APIs.
- 48:26Tell us maybe about that real quick.
- 48:27Well, you can just do some amazing APIs with Flask or Django in general, but with Geo, especially
- 48:33with if you're building like a phone, an iPhone app or an Android app, you know, you can just
- 48:37send your location and have all kinds of context sent back to the application based on these
- 48:43APIs.
- 48:43So they're quick to put up.
- 48:45They're easy to maintain and you can integrate spatial right into it.
- 48:49It really isn't that much work.
- 48:50There's a little bit deeper understanding of like the type of spatial function you may
- 48:54need for a specific moment.
- 48:56But none of that is going to take a master's degree.
- 48:58In fact, I think just like reading some online tutorials or some stack.
- 49:02There's a Geo stack overflow even, I think.
- 49:06Oh, cool.
- 49:06Yeah.
- 49:06The GIS dot stack overflow.
- 49:08Something like that is very, very useful.
- 49:10A stack exchange.
- 49:11Yeah.
- 49:11Probably.
- 49:12There you go.
- 49:12That's it.
- 49:13Yeah.
- 49:13Yeah.
- 49:13Or you can buy my books.
- 49:14Yeah.
- 49:16Now, the amount of data that you have to exchange is actually pretty small for these applications.
- 49:21Like where am I or what path have I taken?
- 49:23Yeah.
- 49:24And so on.
- 49:25But it's easy to build APIs random.
- 49:27I would suspect like on the back end, have it something like Geo SQL, Geo Alchemy 2.
- 49:32Just indexes.
- 49:33Make sure you have indexes.
- 49:34The coolest thing I ended up doing at Zillow was building what we called the Surveyor.
- 49:39It was just a working title, but it was a just literally a web map built in Flask, PostGIS,
- 49:44to be able to actually see a lot of the data that we were building and creating and comparing.
- 49:48Because internally, we didn't have like a mapping tool that could really speak to all of the geospatial data that we had.
- 49:56It was such a surprise to me.
- 49:57And I ended up winning the Hack Week there earlier this year before I left.
- 50:01And that was just like so fun because I presented it at the end of Hack Week.
- 50:06And they instantly were like, yes, why don't we have this already?
- 50:09That's awesome.
- 50:10That's super cool.
- 50:11Congratulations.
- 50:11One more thing on the library side, I guess, is probably worth throwing out.
- 50:15So we've talked a lot about server side things.
- 50:19And you talked about your cool experiences with JavaScript in the front end.
- 50:22If I'm going to do mapping data, especially interactive maps,
- 50:25there's got to be some fancy library that goes on the front end that makes this happen.
- 50:30So what would you recommend to check out?
- 50:33Sure.
- 50:33Yeah, there's less fancier ones, I would say, that Leaflet is considered, which is a JavaScript library.
- 50:39It's considered a medium level knowledge that you could use.
- 50:44And then MapGL, Mapbox GL, I'm sorry, is a little bit higher level, but it has really fine controls over what you can do.
- 50:51And you can have all kinds of events.
- 50:54There are some pure Python front end tools like Dash and a few others that do have mapping integrated as well as graphs.
- 51:02And that can be really useful.
- 51:04You don't have to handle much of the HTML if you don't want to.
- 51:07But I find it, if you're going to get into interactive web mapping, really useful to know both Python and JavaScript to make them work together.
- 51:14Yeah.
- 51:15A lot of the interactive stuff happens on, it has to happen on the client side, right?
- 51:19Yeah.
- 51:19So that means some kind of JavaScript.
- 51:22Get used to curly braces, right?
- 51:24Yeah, exactly.
- 51:25Don't forget the semicolons.
- 51:26Actually, in JavaScript, you can forget them, which is kind of good, I guess.
- 51:29It took me a long time to get into JavaScript because I was so used to the clean nature of Python.
- 51:34Like, and no joke, that attracted me to Python.
- 51:37It was so important to be able to read the code.
- 51:39Yeah, and I feel like JavaScript used to be closer to that world.
- 51:42It used to be pretty simple.
- 51:43Now it's like, you know, all sorts of dependencies require this.
- 51:46And then like, you know, you pack up these things and it's just like, oh my gosh.
- 51:51Or, you know, you pre-compile or transpile your TypeScript over to this and then you pack it up and you minify.
- 51:56It's like, whoa, whoa, whoa, whoa.
- 51:57What happened to just including something in the page?
- 52:00I mean, when I do demos or proof of concept, it's always pretty vanilla with like one mapping library or something.
- 52:08There's some other cool ones too that Uber is putting out a ton of really cool stuff like deck.gl.
- 52:13And there's another one I forget.
- 52:15But if you want to get into super fancy data visualization, I recommend looking into Uber's set of JavaScript tools.
- 52:22It's pretty amazing stuff.
- 52:23But yeah, I prefer a much more vanilla implementation of myself just for my brain to manage it and to understand it.
- 52:32Yeah, super cool.
- 52:33All right, let me close out our conversation with one sort of more general question here.
- 52:38So people out there listening, a lot of them have Python skills, obviously, or building up their Python skills.
- 52:43How much do you need to know to be useful and powerful?
- 52:53Like, do you need to go get a degree?
- 52:54How much work is it to get into this?
- 52:57If you want to really understand the theories behind geography, yeah, I think grad school can be really useful or just an undergrad degree because it really helps you understand like just why it's cold in the Arctic and warm at the equator.
- 53:10Like just at that basic level.
- 53:12It is amazing.
- 53:13And the relationship between the two and the relationship between that and human culture.
- 53:17So if you want to really understand humans, yes, go into geography.
- 53:20But if you want to make a geospatial data pipeline, I think what you really have to know is just like what is the data you're getting in and what is the data you want to get out and what are your resources in between.
- 53:30You don't have to know much more than that.
- 53:32There's all kinds of tutorials.
- 53:33There's books.
- 53:34There's a weekend of exploration ahead of you.
- 53:37It's not that hard, but it is really powerful.
- 53:40Well, it does sound like a really fun area to get into.
- 53:43And a lot of times these visual aspects are pretty cool for people who are not sure that they're necessarily programmers.
- 53:49But then if you build something that you can see and touch and share, like all of a sudden it makes a big difference, I find.
- 53:54Completely agree.
- 53:55It's one of the coolest things you do.
- 53:56And I still get that thrill I got, you know, from showing my grandmother the little lat long that I was able to pull from a shape file.
- 54:03Super cool.
- 54:06All right.
- 54:07Now, before I let you out of here, you got to answer the two questions I always put at the end of the show.
- 54:11If you're going to write some Python code, what editor do you use?
- 54:13Lately, it is PyCharm.
- 54:15I really like it.
- 54:16Before that, it was sublime because it's just simple and you don't have to think too much about it.
- 54:20But PyCharm is fantastic.
- 54:21Yeah.
- 54:21It's my favorite as well.
- 54:22I love it.
- 54:23And notable PyPI package.
- 54:25I mean, we definitely threw a bunch out there.
- 54:26I think PyShape is the lowest level one because unfortunately still this really ancient data format is the major data format in
- 54:36GIS.
- 54:37So PySHP, that tool will allow you to read and write it just in pure Python.
- 54:42Awesome.
- 54:42Cool.
- 54:43All right.
- 54:43So final call to action, people are interested in GIS.
- 54:46What do you say to them?
- 54:47And Python.
- 54:47It's an amazing field.
- 54:48How do I put those together?
- 54:49Yeah.
- 54:50This is the future.
- 54:50Or maybe the future is here.
- 54:52But either way, there's so much that can be done in this space.
- 54:54We're just touching on it.
- 54:56People are just hearing about it, let alone realizing that there's so much more to do with it.
- 55:01So, yes, come join me.
- 55:02Yeah.
- 55:02It definitely feels like maybe the future is here.
- 55:05It feels like part of the future.
- 55:06Like I remember so many of these things, the GPS stuff, the Zillow stuff, all those different just literally blew my mind when I saw them.
- 55:13And I'm reminded of the William Gibson quote.
- 55:17Like the future is here.
- 55:18It's just not evenly distributed.
- 55:20Exactly.
- 55:20Yeah.
- 55:21Yeah.
- 55:21That is so true.
- 55:22The future is generally in your hands these days, but not everybody has the same phone.
- 55:26That's true.
- 55:26That's true.
- 55:27All right.
- 55:27Well, Silas, thank you for being on the show.
- 55:29It was great to chat with you.
- 55:29It was so fun, Michael.
- 55:30Thank you so much.
- 55:31Yeah.
- 55:31Yeah.
- 55:31Thanks for sharing this.
- 55:32See ya.
- 55:32This has been another episode of Talk Python To Me.
- 55:36Our guest on this episode was Silas Toms, and it's been brought to you by us over at Talk Python Training and Linode.
- 55:42Simplify your infrastructure and cut your cloud bills in half with Linode's Linux virtual machines.
- 55:47Develop, deploy, and scale your modern applications faster and easier.
- 55:50Visit talkpython.fm/Linode and click the create free account button to get started.
- 55:55Want to level up your Python?
- 55:57If you're just getting started, try my Python Jumpstart by Building 10 Apps course.
- 56:02Or if you're looking for something more advanced, check out our new async course that digs into all the different types of async programming you can do in Python.
- 56:10And of course, if you're interested in more than one of these, be sure to check out our Everything Bundle.
- 56:15It's like a subscription that never expires.
- 56:16Be sure to subscribe to the show.
- 56:19Open your favorite podcatcher and search for Python.
- 56:21We should be right at the top.
- 56:22You can also find the iTunes feed at /itunes, the Google Play feed at /play,
- 56:27and the direct RSS feed at /rss on talkpython.fm.
- 56:32This is your host, Michael Kennedy.
- 56:33Thanks so much for listening.
- 56:35I really appreciate it.
- 56:36Now get out there and write some Python code.
- 56:38Thank you.
- 56:38Thank you.
- 56:39Thank you.
- 56:39Thank you.
- 56:40Thank you.
- 56:40Thank you.
- 56:41Thank you.
- 56:41Thank you.
- 56:42Thank you.
- 56:42Thank you.
- 56:43Thank you.
- 56:44Thank you.
- 56:44Thank you.
- 56:44Thank you.
- 56:44Thank you.
- 56:44Thank you.
- 56:45Thank you.
- 56:46Thank you.
- 56:46Thank you.
- 56:46Thank you.
- 56:47Thank you.
- 56:48Thank you.
- 56:48Thank you.
- 56:48Thank you.
- 56:48Thank you.
- 56:49Thank you.
- 56:50Thank you.
- 56:50Thank you.
- 56:51Thank you.
- 56:52Thank you.
- 56:52Thank you.
- 56:53Thank you.
- 56:54Thank you.
- 56:54Thank you.
- 56:55you
- 56:55you
- 56:56Thank you.