How To: Reverse Geocode Trip Hazards using ArcGIS Notebooks with DeepWalk

June 3, 2024

This video tutorial explains how to use Esri's ArcGIS Notebooks to reverse geocode individual features, such as trip hazards, to include the address, helping the process of planning and implementing trip hazard removal programs.

Transcript

0:01 Hi everybody, welcome to the ArcGIS reverse geocoding for individual features demo sponsored by DeepWalk. This is what we're working towards, this dashboard where you can select a bunch of trip hazards, and then we have the addresses and the image and some other information about sets of trip hazards to

0:26 help you with your planning and implementation of trip hazard or vertical discontinuity removal programs. So those are what we're working towards, but what we don't have right now is these addresses.

0:37 So that's what we're going to work on right now. So the first thing you need to do is go to your ind file.

0:47 This ind has all of your individual features or manual tags. Say if you were tagging trip hazards or horizontal openings or utilities or whatever.

0:55 All those are stored in this end file. And their point features. They don't have this address field out of the box.

1:04 So that's what we're going to add. So go to your ind file and then go to, data, and then click this, and then click add field.

1:16 And what you're going to do, super important, is add the field address. It's got to be all lowercase or it's going to cause problems later.

1:25 So address. And then click add new field. I'm going to click cancel because I've already done this. And then you'll end up with this field over here that is empty called address.

1:35 And next thing we're going to do is we're going to put the addresses in our address field. So the way you do that is to use a Notebook.

1:44 that we have prepared for you and it's available. You can modify it and do interesting things if you know Python.

1:51 If you don't know Python, don't worry, just follow my lead. So this should be linked somewhere for you to access on wherever you're finding this video.

2:05 So this is our ArcGIS Python notebook, and the only thing you have to change is right here. See where

2:17 Between these quotation marks, you're just going to have to replace this ind with the name of your ind file. Alright, so I'm going to go and take our ind, and it's got to be, I guess it doesn't matter, but it's got to be the same name as

2:38 that feature layer, and not the GeoJSON file. So I'm going to copy that, and then I'm going to go over here, and I'm simply going to paste it right here.

2:51 And then it should just work. So, if you don't really care what it's doing, go ahead and just click this button, and then hit restart and run all settings.

3:01 And it'll just do it for you. You have to wait until all these stars are gone. That just means that the code in that cell is running.

3:12 So, It's running down. The first couple are fast. These, these two, or this one in particular is kind of slow.

3:18 But, very quickly, for the Python nerds out there, feel free to skip if you don't care. Um, this is what's happening.

3:24 So, you import these libraries, just some ArcGIS libraries, and then pandas, which is like Dataframes, Excel, kind of. thing. Um, and then we're connecting to your GIS by making this GIS object.

3:42 Uh, if you're doing this outside of the ArcGIS Jupyter Notebooks feature, you will have to sort of log in here with your credentials.

3:51 Uh, there's a bunch of examples online on how to do it, but it's essentially you have to put your username and password, and then your ArcGIS URL there.

4:00 Um, and then going down to this one, what it's doing is it's looking for that feature service with all of our manual tags in it, and we gave it this name to search for.

4:11 So it's searching your GIS for this name and then it prints down here. If you have multiple with that name or you typed in something different there will be multiple.

4:24 If we put the exact name there should just be one. So it just has that one and then here it just grabs that first search result.

4:35 Say if you have multiple for whatever reason, you're going to have to change the this number to line up with whichever one that you want to grab.

4:44 The next thing is it pulls out the layer from that feature service. There's only one layer, unless you changed it somehow.

4:51 So just grabs the first layer, and then it'll pull out all of the points from that layer. And then here we defined our reverse geocoding function.

5:00 Pretty much you pass in a feature, and then it pulls out the geometry of that feature, reverse geocodes it, and then returns the address from that location.

5:10 And then, that function is used here, so it's going to loop through our features, and it's going to get the address for each feature, and then it's going to add a name, and the address to that field that we added earlier, that's why it's important to have the same name.

5:29 And then, it will add all these updated features to this updated features list. And then, I just went ahead and printed out the first feature, and you can see here, it added our address, which is great.

5:41 And then the very last cell, it just updates our hosted feature service with these updated features. So, if you want to build on top of this, that's what's going on.

5:52 And then it automatically prints out. You know, whether it has succeeded on each object, which it seems to have done.

6:00 Success is true every time. So, uh, that has our base individual feature layer, and you can use this information in any map.

6:10 Now you have, you know, your, your addresses are just attached to all of your manual tags. If you want to use that on other things.

6:16 So the last thing you need to do is you need to update your views. So even though the view is linked to that feature service, it is not, unfortunately, It doesn't automatically update.

6:31 You have to manually tell it to update, which is not that big a deal. So you'll go to your view.

6:39 It's named this out of the box. If you renamed it, you're going to have to go find it. But go to settings.

6:43 And then scroll down. And there's an update view button. And then, it will tell you, hey, this view is referencing this feature layer.

7:00 Or like, that's great, that's what we want it to do. So you can hit next, or you can click this thing over here.

7:05 And you're going to click this, and then go down to fields. And then select fields, and you're just going to want to make sure that this address field has a checkmark next to it.

7:14 I've already gone through this process so it has it, but if not, you just click it and make sure it has a checkmark.

7:19 Hit done. go back over here, oh yeah, and just click around and make sure you hit this update button. And it'll say success!

7:31 The view layer is updated, which is great. And then X out of here, and then, don't panic, but if you go to data, for whatever reason, it does not show

7:44 The address field, which is odd, I don't know why, but it worked. So if you go to Open in Map Viewer, this layer, and then go to Fields, you'll see we have an address field now, which is great.

8:00 So that address field, it's in there. And then, in the next tutorial, we will show you how to use it.

8:13 For further evidence that this did work, I will modify the pop-up for these, so I'm going to go to pop-up, and then I'm going to add See you.

8:29 And then I'm just going to make, I'm just only going to have the address in there. Ah dang it. Select fields.

8:38 Address. And then if you scroll down here, whoa, our address is here. So just further evidence that we do have the address.

8:46 So, yeah, that's a run through on how to use this, uhm. If you want to get deep into it, you can do a lot of cool things with ArcGIS Python API things.

9:00 Feel free to shoot me an email if you have any thoughts or questions on that. I like playing around with it, but it's a super useful feature.

9:07 So hope that made sense. If you have issues, shoot me an email at byates@deepwalkresearch.com. And I'd be happy to help you out.

9:15 Thanks.