ArcGIS Python API in Jupyter Notebooks | burdGIS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] bat-fans today we're going to be looking at the ArcGIS Python API into PI 2 node boat 2 pi to Jupiter not sure how that should be pronounced I put 0 1 at the end of this because I think it's a good candidate for a series of videos and if you'd like to see more of them please hit the thumbs up do subscribe to the channel and please share this video that's a real easy way to show that you are enjoying this topic and away we go if you do not have any edgy software installed or 2 pi 2 notebooks or 2 patern notebooks installed and don't worry about it if you go to this web address notebook says read calm I'm just going to enter that this will take you to the ArcGIS notebook server here this is what a jupiter notebook normally looks like on your machine but this is as use that they provide so you can start you can start a new notebook you can do whatever you'd like to do there's a guide there's some labs some samples all that kind of stuff good fun so you don't need any edging software for this if you would like to install the trial version and please see one of my previous videos and that will give you a certain number of days to toy around the software but if you'd rather not then you can just use this don't think it's possible to save you work from this because it's running on the cloud and it will get white as soon as you leave but this is a place to go if you would just like to try out the code that we are going to run during this video if you do have ArcGIS software installed here I'm in RT is Pro and I just want to show you down at the botton if you go to settings in our list of settings over on the left hand side you can go to the Python settings this will refresh our package information to begin with and you can do the management of all your python environments and such a through RTI's PO in this section so here i've got a project environment that's just dean fault and it tells you where it is stored on your machine it shows you all your installed packages all that jazz so that's good note this cannot modify the default Python environment clone and activate a new environment so if you're making substantial changes to the Python environment you will need a clone of it don't really too much about that we're not going to get involved with anything like that in this vid we're just going to do a very simple that Jupiter notebook so from here the easiest way to start that tube to notebook is to bring up your Windows menu in your Windows key and just start typing Python and we'll get a number of different things by an interactive terminal Python command prompt and if I go to the command prompt and open the file location here you can see that I've got a Python command prompt that is installed in the same place as my arcgis pro and if i start that here we have that default environment start up and this is where it resides and from there to kick off our jupiter notebook i can just type in jupiter notebook hit enter and things will begin and here is our Jupiter notebook excellent with the Jupiter notebook running I have created some extra folders and here we've got one called arc API so I'm just going to click into that and I've got a workbook here called map widget I'm actually going to start a new workbook and I'll just go up to new go to Python 3 and here's our new workbook excellent now I don't want it to be called untitled we'll call it map widget demo let's rename that and if you're not familiar with dukkha a notebook it is a very cool resource in which we can test Python code so it's a nice way to test out ideas and just run things and see what happens now you might be wondering why I launched to put a notebook using the RTI environment that gives us access to this thing called the GIS module and from this you can see from this diagram that we get access to lots of different GIS party is related things so the first thing that we can do in this Jupiter notebook is actually import this GIS module and create a gif thanks for patients so far I promise we're moving on to more fun stuff now and so we're back in Jupiter and in this notebook in this particular cell I'm going to start off by an import statement so I'm going to say from the arcgis package and the GIS module specifically i'm going to import a class called g is using that G is I'm going to assign it to a new variable called my G is that class is now equal to that and I'm going to start another variable called my map and that is going to be equal to my GIS dot map now let's just try running this and make sure that everything is working yes that looks like it's absolutely fine so let's have a look at what we've done we've imported the GIS class we've assigned it to the variable my GIS and then we've started another variable my map and we have taken the map method from the my GIS class and assign it to my map great now let's put in my map and run this again and this is where we should see some magic happen this is what's known as the map widget so we've got this working now our Jupiter notebook notice that we've got this very clever little doohickey appear and if we click on that we can get into a 3d scene you can do all your zooming panning whatever you'd like to do as per usual so this map widget is a nice way to test out different things that you might be doing with the ArcGIS Python API now this map method can actually take some arguments so here I'm going to add in me Amazon basin and this will act as a kind of crude search function so if we run this again there we can see were focused in on the Amazon basin so you could try putting anything in there you could put postcodes in there whatever you'd like currently we look like we are zoomed out a little bit far I'm just going to add a zoom level of four and let's run that again hmm didn't change that much let's try zoom level of 10 this should bring his in super close and it does so I'm gonna go back to four actually I prefer that one but you can see that the map method takes some arguments there are their arguments that we could add but I'll let you go to the dot and work those out for yourself now the current map based map is the website topographic with some labels as well which is okay but you might notice from most of my screens that I prefer dark mode so I'm going to add a base map and I'm going to say my map base map and then equals the dark gray vector now there is a bunch of base maps available from ESRI and again you can find these in the dot I'll show you a link to the dots at the end of the video and how the work but if we go my map base map equals dot go vector and then we run this you can see that we now have a dark gray base map excellent so this looks a little more modern a little bit cooler and what should we add next we could have a look for some Delta no this is not the end of the video but I decided to show you the dots a little bit earlier so if you have a look at areas website in the ArcGIS for developers you can find the ArcGIS API for Python and we're going to be looking for some data next so we're going to be using the search function and the dots are pretty good for ArcGIS API for Python so that's great news and what we're going to be doing is using the search function so our GIS dot content search is what we want to be using and this is how it looks so we can see that looks all good and I've spent quite a bit of time in the docs to put this little example together for you now when we're searching for content it will be looking at the living Atlas so as use living Atlas all the data that's available where and don't miss something not signed in here this is just stuff that is freely available so let's have a look for modis look for fire yeah these suggestions look good satellite murders thermal hotspots and fire activity so if we search for that living out those we'll bring this up and I'm just in my browser here having a look and here we can see the Modi's thermal hotspots and fire activity now if I click on this that is going to take his into RT is calm again I'm not signed in yet these data are freely available and we get a description as to what this data layer is all about so it's detectable thermal activity from motor satellites for the last 48 hours comes from NASA etc etc and here we have a URL to it as well and if we go up into the URL at the top you can see that it has this ID here and it's just a string of alphanumeric nonsense but that ID becomes quite important and I'll show you why when we get back into our tube it's an output so what I'd like to do from the notebook is search for these particular data in order to perform our search I'm going to start a new cell so I'm just going to say escaped hit escape and then press B and that will create a new cell below for us I'm going to start a new variable called fire search that's going to be equal to my GIS content search and in this search let's begin by searching for fire now if I run this we have no output all that's doing is searching for fire but we've not actually asked by them to output anything so I'm just going to put fire search at the bottom and that will print whatever is in here let's have a look we've got all sorts item title we've got Sentinel two views world imagery Firefly all sorts of different things and you can see that we've also got this type map image layer web mapping application all different kinds of types now if I remember correctly this had modis in it so let's put the modis in there as well can we see that thermal hotspots and fire activity that's a word map I'd actually like the type to be a feature layer let's see if that holds it in anymore and our title is going to have these words in it notice thermal hot spots from fire activity visitor feature local action it's owned by ESRI and it's a live feed it's very good now if we wanted to print just one of these items we'd refer to it by number and don't forget that in a list in Python we start with the number zero so if I want to print the first one I could put square brackets around it and put in a zero and if we do that here it is notice that it changes as well so instead of just printing draw rest is in Brawl list it's actually printing the iron itself and if I were to click on this it would take his back to our GIS online so that's pretty nice and this does actually have properties as well so if I put a dot in there think we should be able to put that in and just ask for the ID and there it is remember that alphanumeric nonsense that we had previously that is the ID that we can use to refer to that particular layer now that we have the ID we can actually get this layer so I'm going to make a new variable called fire layer once I stop my typing out and that is going to be equal to my GIS dot content don't get so I'm going to use this get function and I'm gonna get the ID I'm going to get by ID of the first item in my fire search so let's run this marvelous and then let's have to put the fire there and see what happens and there's that fire layer so now we have the layer that we have retrieved using the ID and that gives us a variable with that layer in it so if I were to take my map and I was to add oops add a layer and make that the fire by app and then to recreate my map widget let's have a look what happens is my map again and look what appears this is the modus fire data for the last 48 hours obviously fires have been big in the news at the moment and so this is partly a way to show you how you can access these data and investigate for yourself what's happening across the world in terms of fire now I'm not particularly keen on the way that these symbols are drawn and if we click on these this map widget is pretty comprehensive if I click on this it will actually bring up all the information all the attributes of that point so very very cool we've got brightness reading the object ID what scan it's from what track it's on which satellite sensor it comes from the confidence limit so this could be good that's 100% confident that this is a particular fire we've got the brightness and then we have got the output in megawatts and this particular one is 304 megawatts so it looks like the interesting attributes here it could be the confidence level and the mega watt output I'd need to check the dots to find out what FLP exactly stands for and it's a good idea when using any data to always make sure you know exactly what all the attributes are so perhaps we could do that now here I've just jumped back to the living atlas and having a look at this modus thermal hot spots and fire activity data description and you can see here in the source we have NASA active fire data for world so if I click on this link that will take is to that and the link brings is here firms fire information for resource management system now note at the top due to heavy usage please consider using firms to likely this is because of the media storm around the Amazonian fires so lots of people accessing this data at the moment we do have old data in the archive and we've got all sorts of different data files that we can download but nowhere on this page at the moment can I see anything about the metadata but if we go down to the resources we've got the modus active fire user guide that is probably going to be the most useful so just have a look at this and there we go and we've got the active fire product user's guide again what I'm trying to do here is just find out what all these things mean so with this PDF open in my browser if I just go for ctrl F to search I can see maximum FLP is going to be on page one for section two point two three so let's go to page 24 and let's have a look see if we can find it was the FRP maximum fire radiative power all five pixels falling within the each grid cell is provided on daily basis of the max FLP so FRP stands for fire radiative power might also be useful to have a look at how that confidence limit is calculated as well so really here I'm just showing you that it's really important if you're using any data to double-check and make sure you know what you're looking at now what I'd like to do next is to have a look at these data and start looking at how we could visualize it differently in our map widgets so that could be a potential video if you're interested in seeing that video again please don't forget to Like don't forget to subscribe and please share this video as well that will let me know that you guys are interested in this and I will have a look at how we could thin this data out my ideas so far putting some kind of filter on it or maybe using a pasty so that we don't show the least confident fires looks like it has some of that built in already expect this to be less confidence yeah that's n 59% so I might put a filter on and just cut those out and then we could have a look at some different styling as well it does look a bit overwhelming when you zoom out and it looks like the whole tropics are on fire but thank you for watching I hope you found this video useful and don't forget happy mapping
Info
Channel: burdGIS
Views: 9,049
Rating: 5 out of 5
Keywords: burdGIS, GIS, mapping, geospatial, cartography, remote-sensing, ArcGIS, python, jupyter, arcgis API, python API, MODIS thermal hotspot, fire data, amazon basin, amazon, brazil, map widget, add data
Id: xcM-wEN6vQQ
Channel Id: undefined
Length: 20min 57sec (1257 seconds)
Published: Tue Aug 27 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.