So in this demo, we're going to start looking at spatial analysis, and
this is a way of working with multiple different layers to understand some aspect
of the real world.
In very complicated spatial analysis, this is combining several different layers.
But we're also gonna look a little bit at some of the more simplistic
types of spatial analysis, where we might do something like joining two layers based
on their spatial locations or creating zonal statistics for
a raster based on some sort of vector or raster data.
Now, included in this are a lot of the interactive selections that we did
in the module on vector data, which is the very third module.
So I encourage you to go back and look at those.
I'm not gonna demo them but you might wanna watch the video for those
again to understand how to do some of these more complicated vector selections.
So there's several different data types that are in here, in our Demo 11 data.
We have things like census tracks, locations of colleges,
highways, libraries, places, public schools, railroads, zip codes.
We have some of our topographic data that we created in the preceding module.
We have the locations of the soils that we digitized around Notre Dame
with the table joined on.
It gives the descriptions, so you're not going to probably use all of these.
I'm probably not going to use all of them during the demonstration.
But it's a good idea to have a lot of these data in place.
Now most of the ones for Indiana here come from the Indiana Map Project.
So if you Google that, you can probably find a lot of these data.
Most states have a GIS Clearinghouse that has things like the location of
populated places, public schools, railroads, things like that.
So let's start a new blank map document and we'll go ahead and
add some of these in, just to begin working with them.
Now the first thing that I'm gonna show you to do is how to do a spatial join.
This is essentially permanently adding something kind of like a selection, to
take the data from one layer and append it to the data from another
layer, the attribute table from another layer, based on spacial locations instead of being based
on an index field in common between the two.
So we're gonna add in some
data from our Demo 11 data.
And let's go ahead and look at how we might wanna, if we wanted to append
the location or the name of the zip code onto every single one of these places.
So we'll choose Places, I'm just holding down Control and choosing Zip Codes.
So, what you see is I have polygon shaped file of all the different zip
codes of Indiana.
And the location of all of the populated places
above a certain population threshold.
So we zoom in just a little bit.
We can use our Identify tool to see that yes,
each one of these polygons is the zip code.
Yes, each one of these points is the name of a particular town,
village, city, the county it's in, estimated population, it's elevation,
what USGS quadrangle it's a part of.
But we don't have the zip code,
and that might be useful information for us.
So to do this spatial join, we do them in very similar way
to how we would do the initial join in a more tabular way.
So we're gonna right-click on the table,
the file that we want to join data onto and go to Joins and Relates, choose Join.
Now the big difference here is this very
top thing that we didn't look out in the modules on tables and databases.
We're gonna change it to be from Join Attributes from a Table
to Join Data from Another Layer Based on Spatial Location.
There's only other one layer in here, so
it's already guessed that we wanna do zip code.
And what we're doing is we're gonna ask it to join polygons to points, and
it's gonna give us some options of how we wanna do this join.
So we have two options for polygons to points.
We can do either it falls inside.
So if a point falls inside a polygon, it gets the attributes for it, or
is closest to.
Now if it falls inside of it, it gets a zero.
I'm gonna choose is closest to.
That way just in case there's some that are just slightly outside of Indiana,
we'll still know what the closest zip code within Indiana is.
Plus, it give us the distance as well, which could be useful if you had
things like points to points or something like that.
So I'm gonna give it a better output name.
I'm gonna send it into Demo 11 folder.
Then I'm gonna call it Places with Zip Codes Indiana.
Places with
Zip Code.
That is not how you spell "code."
So I'm gonna hit OK.
And this is another difference here, is that I always have to define a new file.
I can't just do these things temporarily, the way I could the other joins.
So now, if I look in the attribute table for here, it's appended all of
the information from that other attribute table, based on whatever's closest.
In this case, everyone falls within some zip code, so all the distances are zero.
But now, for each place, I know what the zip code is.
Now that's, that's all fine and good.
Let's look at one more example that's gonna give us just a little bit more
information about different, the intersection between two different layers.
So let's add in, Public Schools and Libraries.
What we're gonna do is we're gonna find out what is the closest library to
every public school.
So Public Schools is the layer we wanna work with.
We're gonna go to Joins and Relates, Join.
It's already gotten us Indiana library.
We have different options.
It could give us a summary based on a certain threshold of how close they were.
Or what we can do is, give it simply the value of all the attributes of the points
in the layer that's closest to it.
So, we wanna do is this.
So, it's gonna give us now is the name of the closest library and
how far away it is.
So, I'm gonna call this Schools with Libraries.
Indiana. It'll take it just a second to run, and
again it looks identical to the public school's
layer, it shouldn't look any different, but
when I look in the attribute table,
what's happened is that I now have the name of the closest public library and
how far away it is in meters.
So some of them are very, very close.
Some of them are quite a bit further away.
And I could do things like find out, by finding
this sorting descending here how far away the furthest
public school from from a library is.
So this is the school that is the furthest away from a public library and
the library that it’s close to is actually an academic library.
It’s not a public library.
So those are zonal, I'm sorry, spacial joins.
Those are ways of appending information from one shape file on to another.
Now I wanna look at what's called zonal statistics, and
these are a way of summarizing the values of a raster over particular areas.
Now, those areas can come from a vector polygon file, or
they could come from a classified roster.
In this case, we're gonna look at getting the average elevation and
slope for each one of the soil classes.
So, what we're gonna do is I'm just gonna turn off all of these layers
that are in here, and I'm gonna go ahead and add in
my soils as well as
the slope, and the DEM, the elevation for Notre Dame here.
So, this is gonna be a much smaller couple of layers, so I can easily zoom to them.
And what we have are the classified soils that we built.
And then, the slope and the elevation.
If we wanted to, we could change the color around here,
so that this is our elevation color here.
It's a little harder to find the slope color.
So, to do the zonal statistics, we need to go into the Arc toolbox.
So go ahead and go into your toolbox.
You're gonna go down to Spatial Analyst.
Now, if you're getting, if it gives you an error when you try to run this,
remember that you may need to go to Customize Extensions.
Turn on 3D Analyst and Spacial Analyst if they're not already on.
You're gonna go down to Zonal at the bottom.
And what we want to choose is Zonal Statistics here, the first one.
Now it wants the zones, we're going to give it soils.
The zone field is soil code, we want to find out for
each soil code what this looks like, and let’s start off by doing the DEM,
we're going to get the mean elevation for the DEM.
So let's give this a permanent name.
We'll call it Zonal DEM or
something, Soil Zones Elevation Mean.
.tif
Then again you can set different statistics down here if you wanted to.
So this will run for a moment, and what you'll end up with is a measurement
for each soil class, what the average elevation for that particular polygon is.
Now I find this to be kind of useless to have this raster version of it here.
What I think is more useful and what I encourage you to play around with more
is this Zonal Statistics table down here.
Cause what this will do is we give it pretty much the same information coming in,
soils, zone field as soil cloud code.
Our value raster, I'm gonna give it the DEM again as well.
And I can leave it as all statistics here.
Give it a permanent name.
Call it Soil Elevation Stats.
And then when I hit OK, It'll run for a minute.
And instead of giving me this raster layer that I would have to actually
click on to find out what that value is.
What it's giving me instead is a table.
So, if I open this table down here.
For each soil code, it's giving me how many pixels there were
that had that value, what the total area of it is, the minimum,
the maximum, the range, the mean, the standard deviation, and the sum.
So it's giving me a lot of information about each one of those soil codes that's
in there.
So that's probably a little bit more useful of a way to get summarized
information about all of the different classes that you have across a raster.
But you might want to end up using the one that the regular zonal statistics if you
then wanted to use that in further spatial analysis.
So there is a purpose to the zonal statistics not as a table.
But the table itself gives you a little bit more of a useful output.
So if you notice, because we have a table in here with no spatial data,
it's just associated.
It's switched us over to the list by source from list by drawing order.
So I'm just gonna go back to list by drawing order.
And now I want to show a few different techniques before we start working
with the actual raster math and creating more formalized models.
The first of these is just working with distances, so working with
what we might call a straight line or cost weighted distance between two things.
So let's go ahead and look at how we might do distance to water.
So we're gonna just simply add in
Notre Dame Water here.
And what's that gonna give us is, just turning off everything else, is
a pretty clipped-down section of the water for all of Indiana.
It just is the area sort of around right there.
So if we wanted to use this in further spatial analysis, we’d need to have it in
a raster format.
We need to know for each area within that rectangle,
how far away from water of any form are we?
So we do that by creating first a Euclidean and
possibly a Cost Weighted Distance in the Spatial Analyst tools under Distance.
We're gonna start with Euclidean Distance so as the crow flies.
So our source data is Water.
Our output raster is going to be, I'm gonna call it,
Euclidian Dist to Water.tif
And I'm going to go ahead and hit OK.
If you wanted to set the cell size smaller,
it would be a little bit prettier of a surface maybe.
If you wanted to give it maximum distance, you could do that as well.
Actually before I hit OK there's one other thing I'm going to do.
In this case it's not a huge deal because the polygons themselves mostly make
up the entire rectangle.
We do need to set the extent as well.
Because when you're doing distance to something,
it doesn't really know where to stop.
So frequently the default will be that it stops
as far out as the furthest away water is.
And because we actually care about a little bit further out than that,
we want to go ahead and set our maximum extent.
And we do that in the environments button down here.
This is a new one, we haven't touched it before.
But what it lets us do is set a lot of very specific things about
this particular analysis.
Here we want to set Processing Extent to be the same
as no, any of the Notre Dame ones is okay.
So we'll do Notre Dame DEM.
Go ahead and hit OK.
So, what it's done is it's gone through and it's calculated
for that area that we have, for that area of the DEM,
how far the distance is to the closest instance of water.
So we have areas that are very far away.
Up to almost a kilometer away from water.
The areas there very, very close.
And again, these are continuous values that have been just classified to make it
look a little bit more like these sort of circular radiating distances here.
So we can also do with what are called cost-weighted distances. In this case,
what we're doing is we're actually using something else to measure,
to sort of weight how far away we are.
How hard it is to travel across a particular surface.
That's Cost Distance here.
Now, you might build a cost raster that's very complicated.
In this case, we're just gonna use this slope, and this is a relatively common,
simple way of doing this.
Higher sloped areas are harder to pass than lower sloped areas.
So, bring in your water as your Feature Source data.
The cost raster is just simply gonna be the Slope.
If you wanted to do backlink rasters, these are other sorts of ways to set it.
I'm just gonna simply give this as an output.
I'm gonna call it
ND_CostWeighted_ToWater.tif
Now in this case because it's gonna be the exact same as the slope.
We don't need to set the extent.
It's not as big a deal to set the extent.
But I'm still going to do it just because it's an idea that you should get this in.
It should become kind of muscle memory to go into Processing Extent and
to choose something that is that full extent.
So I'm just going to choose DEM here.
And then you hit OK.
It will run for a moment.
What it should come up with is something that looks kind of like the Eucledian distance.
But is weighted based on the slope as well.
So this is now a measure of the relative difficulty of crossing,
of getting from here to the closest water,
or from here to the closest water.
I don't want you to think that these are actually distances.
These are not distances.
They're no longer sort of a mathematical measure, they're a measure of the relative
difficulty of passing, of starting at this point and getting to water.
Or starting at this point and getting to the closest instance of water.
All right, so up until now we've just been working with individual rasters,
representing a single factor, distance to water,
how hard it is to pass across the surface.
Now, what we want to do now, is introducing tools to combine different
layers to model something, some other characteristic.
So the model we're gonna do is a little bit fanciful and a little bit silly.
But what I want to do is we're gonna find a young hobo,
find the best location to live in sort of northern Indiana.
Now our hobo has a series of needs.
We want to think about how to convert each one of these needs into a raster that we
can then combine into a single model that is good locations to be a hobo.
Now the most attractive thing obviously about being a hobo is solitude.
So we want to avoid high population areas.
We want to find a way to model areas that have high population as not optimal,
as not being good locations.
We also want to find areas that are close to public libraries so
we can check out books, so we can check out videos, so
we can do all of the things on the sort of intellectual side of being a hobo.
And because railroads are essentially the life blood of a hobo, we want
to make sure that we have good location ranked as areas that are near railroads.
So we need to decide the three different layers that we wanna need.
Whether we're going to need population, libraries, and railroads.
Convert those was into rasters in some way.
Change, classify those rasters into values that are sort of
ranked and then combine all those ranked layers into a single model.
So I'm just gonna remove a bunch of these layers that we've been
working with so far.
Alternatively, we could just start a new map document.
Actually, let's just go ahead and do that.
Let's just start a new map document.
Again, feel free to save yours if you want to.
I'm not going to save mine.
And then I'm simply gonna add in the three layers that I think I need, so
I'm gonna add data.
Well distance to railroads is gonna be important.
So will the locations of libraries.
And then to get population,
what I actually am gonna use are census tracts here.
So we've worked with these a little bit,
but these are somewhere between a block and a county,
distinctions that the US census does when it runs the big census every ten years.
So I'm gonna add these three layers in.
It'll take a moment to render.
But we're going to start off with population.
So if we look into our census tracts here, we have a measure of total population.
And what we wanna do is somehow create a raster that has those values in there.
So up to this point when we've created rasters from vector data,
we've worked with things like distance.
With how far away we are from libraries, railroads, schools, things like that.
And we're gonna continue that in the later parts here.
But the nice thing about polygon data like this
is that they're already kind of continuous across the area we're interested in.
They're already continuous across Indiana.
So all we have to do is convert this vector data
into a roster with population as the ranking that we wanna use.
So we're going to go into our Arc toolbox here.
We're gonna go to Conversion Tools.
Then we're going to go to Raster.
We're going to do Polygon to Raster.
So our input features are going to be the census tracks.
Our value field is going to be Population.
I'm gonna go ahead and give it an output name of Indiana Population, or
sorry, Hobo Population
.tif, and I'm going to leave everything else kind of as is.
So this will run for a second, and
what it's going to give us is a new raster
layer that is just essentially those
polygons converted into raster data.
Ranked from a population of 0 up to a population very, very high of 8006.
706. So because
these values are really high we want to have them scaled to the same number.
So we want to set it up so that areas with the high population are very,
very lowly ranked.
And areas with a low population are very high ranked.
So we're gonna do this by something called a reclassification.
So we're gonna go back into our Arc toolbox.
We're gonna do this for all three layers so
that they're ranked from 1 to 10, and then we'll combine them together.
Into Spatial Analyst, Reclass.
Reclassify.
So we're going to bring over our Hobo Population.
A Reclass field is just value.
We're going to go ahead and click on the Classify button here
because that'll let us set some other things.
We see something that looks sort
of like what we've seen before.
We're gonna leave it as natural breaks.
We're just gonna make it ten classes.
Hit OK.
So now we have old values,
0-568 is a value of 1.
5413 up to the maximum is a value of 10.
That is not what we want.
We want areas of high population to be ranked low.
Areas of low population to be ranked high.
So we want to go ahead and click this Reverse New Values.
What that'll do is give the low values the higher rankings,
the high values the low rankings.
We're gonna change this to be permanent.
We're gonna call it Hobo Population Reclass.
And hit OK.
So it'll run for a second and
now it's just simply giving them a 1 to a 10 there.
So the next stage of what we want to do is libraries, so
I'm just going to turn these off and turn on Libraries.
This is one where we have point data,
and because we have point data, we need to do a distance to them.
Or at least, in this case we want to do a distance to them.
So we're going to do Distance, we're just going to use
Euclidian Distances here, bring over Libraries.
We'll call it Hobo_Libraries.
I’m getting very creative in my names here.
.tif
If we wanted to,
we could set our Environments, but it'll end up OK with this one.
But you could go set your environment processing extent to be the same as census
tracks that way you're sure.
And go ahead and hit OK.
So it'll run for a second and we should get distance to public libraries now.
You can see that they're very heavily concentrated in the larger cities so
Indianapolis, Gary, South Bend.
Now, we have this halfway there, but we do need to go ahead and
do our Reclassify again.
So this is another case where
the first thing we want to do is we're actually defaulted to 110 here.
If it didn’t, you'd go into Classify and change the Classes to 10.
In this case, far away from a library is not optimal.
So far away from a library should be 1, close to a library should be 0, or
should be 10.
So we're gonna reverse the values again.
So if you're close, that's a high value.
If you're far away, that's a low value.
And I'm gonna call this Hobo Libraries Reclass.
So it's done the same thing for us now.
It's actually given us this maximum value in here.
If that happens, you can get away from that in your Reclass.
Basically what happens is it only uses a certain number of points to build
The number of classes that it's gonna use.
So if you wanted to reclassify it and just change, when you go into Classify.
Just change this top one to be significantly bigger.
So we'll just change it to be so it's
98,000 now, so we'll just change it to be 100,000.
So it should catch any of those aberrant values that got kind of missed.
So I'm just gonna go through.
Call that Hobo's Library Reclass2.
Now it should avoid those high values that didn't really make much sense to
me before.
So I'm just gonna remove my previous one and just work with this second one here.
Now this last one we want to do is we want to set it up so
that our hobo has to live near railroads.
It's just not possible to not live near a railroad.
Otherwise he'd be a hermit, not a hobo.
It's just not something that we want to do.
So as long as they're closer than five kilometers away from a railroad,
that's possible.
Any further away, you can't live there.
So we want to make this actually what's called a binary characteristic.
So the first step, as it was before, is we're gonna to through and
just gonna turn on all our Railroads and turn off all of our other layers.
And we're gonna do a Euclidean Distance based on Railroads.
We'll call it Hobo Railroads.
Again, I don't really need to, but
I'm going to set my processing extent to be the same as the census track.
Go ahead and hit OK.
Should run for a moment.
And now it's giving us distance away from any one of those railroads.
So what I want to do in this case when I build my reclassification, is I want to
make it so that anything that's less than five kilometers away is a 1,
and anything that's further than five kilometers away is a 0.
That way when I multiply that by my final model, I end up with something that's just
gonna throw out all these values that are further away.
So I'm gonna go into Reclassify and bring over Hobo Railroads.
I'm gonna go into Classify and I'm just gonna change it to be 2.
And then all I need to do here is change this value to be five kilometers.
So 5000 meters. So I have a 0 to 5000 I want that to be a 1.
Add 5000 to the maximum, I
want that to be 0. And
I'm going to call that
Hobo Railroads Reclass.tif
And now I have a measure that is basically if you're further away than
five kilometers, you're purple, you're 0.
If you're close enough, that's a possible thing, and that gives you a 1.
So now the only step I have left is to create a final model out of this.
So I want to combine my three reclassified ones.
Just minimizing things here, into a way that gives me.
Actually what I want to do is the average of these two, so Population and
Libraries multiplied by my Railroads, which will throw everything else out.
So I do this in Map Algebra.
So it's Spatial Analyst > Map Algebra > Raster Calculator.
Now I simply build this together into an equation.
So, I'm gonna click on layers, I'm gonna click on numbers,
I'm gonna click on operators over here, until I have an equation.
So, what I wanna do, and you can copy this out of the notes if you need to,
is gonna do Railroads multiplied by, and
I'm just gonna create a couple of these, here, so that I can do Libraries
plus Population divided by 2.
Sorry, missed a close bracket, there we go.
So it should look like that, so
it's basically taking the average of these two layers and multiplying it by that one.
I'm gonna spit it out as the very scientific measure of hobosity
for all of Indiana.tif
So now when I hit OK, it'll combine those three layers.
It'll look at each individual pixel, it'll do that equation on them.
It'll create a new layer that gives me the very highly ranked areas,
the less highly ranked areas, the very low ranked areas and all the places that it's
just simply too far away from a railroad to give me a value.
So if you imagine if we hadn’t done that binary calculation,
these spots would have values.
They’ve become 0 because we put that in there,
because we just want to simply ignore them.
So you can try to find the areas that are very highly ranked.
They tend to be low population areas that are near public libraries.
So that is again a pretty fanciful silly example of how to create a spatial model.
But you can do exactly the same thing for
things like erosion risk, which we'll work on a little bit later.
For modeling how to, where you might find a particular species or
where you might find a particular type of archeological site.
As long as you have the data layers in there, and
can combine them in a way that makes sense in the field you’re coming from.
You can create a more formal model out of it using these tools.
So we'll continue this discussion of how to do this with some of the prebuilt tools
that are designed for doing hydrological analysis in the next demonstration.
So, thank you very much.