Map Algebra and Math 2

Python for Spatial Analysis in ArcGIS Advanced Python in ArcGIS for Spatial Analysis
10 minutes
Share the link to this page
You need to have access to the item to view this lesson.
One-time Fee
List Price:  $99.99
You save:  $30
List Price:  €91.99
You save:  €27.60
List Price:  £78.70
You save:  £23.61
List Price:  CA$136.12
You save:  CA$40.84
List Price:  A$149.36
You save:  A$44.81
List Price:  S$134.57
You save:  S$40.37
List Price:  HK$779.70
You save:  HK$233.93
CHF 63.61
List Price:  CHF 90.88
You save:  CHF 27.26
NOK kr746.97
List Price:  NOK kr1,067.14
You save:  NOK kr320.17
DKK kr480.44
List Price:  DKK kr686.38
You save:  DKK kr205.93
List Price:  NZ$163.32
You save:  NZ$49
List Price:  د.إ367.26
You save:  د.إ110.19
List Price:  ৳11,670.06
You save:  ৳3,501.36
List Price:  ₹8,326.90
You save:  ₹2,498.32
List Price:  RM468.45
You save:  RM140.55
List Price:  ₦150,334.96
You save:  ₦45,105
List Price:  ₨27,760.43
You save:  ₨8,328.96
List Price:  ฿3,602.53
You save:  ฿1,080.87
List Price:  ₺3,220.12
You save:  ₺966.13
List Price:  B$510.29
You save:  B$153.10
List Price:  R1,818.79
You save:  R545.69
List Price:  Лв179.65
You save:  Лв53.90
List Price:  ₩135,856.19
You save:  ₩40,760.93
List Price:  ₪369.98
You save:  ₪111
List Price:  ₱5,788.84
You save:  ₱1,736.82
List Price:  ¥15,569.94
You save:  ¥4,671.45
List Price:  MX$1,659.36
You save:  MX$497.86
List Price:  QR363.44
You save:  QR109.04
List Price:  P1,350.41
You save:  P405.16
List Price:  KSh13,098.69
You save:  KSh3,930
List Price:  E£4,680.53
You save:  E£1,404.29
List Price:  ብር5,724.51
You save:  ብር1,717.52
List Price:  Kz84,838.74
You save:  Kz25,454.16
List Price:  CLP$89,276.78
You save:  CLP$26,785.71
List Price:  CN¥709.51
You save:  CN¥212.87
List Price:  RD$5,838.06
You save:  RD$1,751.59
List Price:  DA13,448.41
You save:  DA4,034.92
List Price:  FJ$222.79
You save:  FJ$66.84
List Price:  Q774.26
You save:  Q232.30
List Price:  GY$20,849.79
You save:  GY$6,255.56
ISK kr9,678.91
List Price:  ISK kr13,827.61
You save:  ISK kr4,148.70
List Price:  DH992.23
You save:  DH297.69
List Price:  L1,765.83
You save:  L529.80
List Price:  ден5,662.25
You save:  ден1,698.84
List Price:  MOP$800.92
You save:  MOP$240.30
List Price:  N$1,823.35
You save:  N$547.06
List Price:  C$3,669
You save:  C$1,100.81
List Price:  रु13,286.84
You save:  रु3,986.45
List Price:  S/372.17
You save:  S/111.66
List Price:  K387.03
You save:  K116.12
List Price:  SAR375
You save:  SAR112.51
List Price:  ZK2,543.81
You save:  ZK763.22
List Price:  L457.65
You save:  L137.31
List Price:  Kč2,272.97
You save:  Kč681.96
List Price:  Ft35,512.48
You save:  Ft10,654.81
SEK kr747.87
List Price:  SEK kr1,068.43
You save:  SEK kr320.56
List Price:  ARS$88,665.87
You save:  ARS$26,602.42
List Price:  Bs688.59
You save:  Bs206.59
List Price:  COP$381,601.87
You save:  COP$114,492.01
List Price:  ₡51,006.90
You save:  ₡15,303.60
List Price:  L2,467.63
You save:  L740.36
List Price:  ₲746,739.85
You save:  ₲224,044.36
List Price:  $U3,879.22
You save:  $U1,163.88
List Price:  zł391.77
You save:  zł117.54
Already have an account? Log In


This class I'm going to show you a real application. By improving the current flood inundation map resolution. We will practice the tools that we learned before looking at a flood inundation map over our toe collected map. The blue is water depth, you can see the water depths the resolution is very coarse. There is a because of water depth is generated based on the core Digital Elevation grant meter off the surface. As you can see, the water depth.

Cell size is the same as the Digital Elevation cell size, which is about 20 meters with better resolution. For instance, we have clicked a better resolution digital By overtone, we should be able to improve over current flood inundation map horizontal resolution, my candle looks smoother instead. So, mosaic like this is over go. As you can see, the flood area is clearly marked on the remote system map you can actually see to which building the water will reach to achieve over go schematize over problem. So, basically we have the course which is 20 meter resolution, water depth and we have the 20 meter DTM which was used to generate the water depth. We use plot function we learned last class to generate the smooth water surface elevation And then we use minus two water surface elevation minus the finer dm we collected to use the drone to gain over finer resolution of water depth, we need to pay special attention to the area which is not flooded, because those area due to the plus and a minus of the digital elevation model was different a resolution noise will be created and those data there is meaningless.

Based on this scheme, I have created the Python code. This is the first part of my Python code. We do find the path to save the data. And then we created a name for each of the file we want. And the last part is a tour. So we will use the reason that I'm using Python To do this is to actually have 361 flood maps needed to be processed.

So it's more reasonable to write a program to let the computer do the repeated works. Here are all my maps which are timely out but now let's format the code according to the scheme first part plus, in the code I write a plus formula and the input is the loop, orange no water depths, enter the base map, the output I will just call plus output and I give it the correct name created the boundary for the flood area is much more tedious. Cover material is a raster data, which shows the flood depths from zero to the maximum. We need to define the flood area first, we can use the greater than to define the area for instance, with that For all the depths greater than 0.1 meter of flooded for the area less than 0.1 are not considered a flooded area use greater than 0.1 we will gain a raster with value zeros and I want to zero is the land, the ones is a flooded area, we only need the ones so we will make a layer selector zero and it deleted that there we will only leave the one.

The reason we have to make a layer is because the Select function needed to do that any future classes, we will learn more about the Select function. Now let's see how the code will summarize all that. Here's the code first any use greater than the threshold is 0.1. output is greater than output and then we use Make a layer function and then we use select grade code equal to zero to select the zero, and then we use the Delete function to delete all that code left behind this array notation here about the water surface elevation, we need to resemble it to make sure it has the same resolution as over daunting and this is the how the code look like the input is the plus output. And then the output is the plus or other control variables, other resolutions cell size and how you want the cell to be resembled using the near wrist format.

Now this code is finished with a plus the navigation area resample. For the water surface, we just needed to write the code for the second part which is minus and that getting rid of some noise to use in addition you area shape file as the mass. Before that, let's check over first code output. Let's see, I have put in the orange no soft material under this backup file. This is all my 361 flood inundation map and the first output which is the result of the class. There is no greater than now, there is Dan Porter Without the flood inundation area, so using what we gained here, let's finish our second part of the code.

This is the code. It has its basic structure. Import, our PI will ask for the environment settings. And then we have the directory for the info the files and a directory called the output files and afford the loop. We reading each of the outputs can we give it to our index? So when we read in the data, we make sure the same file and a DA Last raster file are the same sequence are at the same sequence.

And for making the output numbering in a way with three digit, we add our IF function here. If the number is smaller 100, we give it two digit, or one digit to feel the digit to make sure it's a three digit number. And then it's the last part inside the loop. We want to make sure we do the minus function, we do the cut function, and we delete the unnecessary data to relieve some storage space for over computer. The action part basically, first we did a minus use the water surface elevation, which is a plus r minus the DM and here's the code We use this formula, the input is the path our output after subtracting, find our dm is minus. And then we needed to cut the minus using the flood inundation ship.

Here is the code input is a minus, and the greater shape which we created before, and the output is just a minus. Finally, we can delete the files data we don't have to run the code we gain the result, I just add a one layer to make a demonstration. As you can see this layer compared with the original layer, the resolution has improved a lot. When we zoom in, you can see it more clearly. See, this is a resolution weaken after run the code. Over flat tabs look like this.

Now it'll look like this much improved before after

Sign Up


Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.