2
2
3
3
## Habitat Corridor Mapping
4
4
5
- In this example, we'll map a habitat corridor in cnetral Maryland. We'll use
5
+ In this example, we'll map a habitat corridor in central Maryland. We'll use
6
6
SpatialGraphs.jl to convert the landscape into a graph, then calculate cost
7
7
distances, and finally convert the result back into a raster to display a
8
8
least cost corridor in space.
@@ -30,8 +30,8 @@ nothing
30
30
31
31
Now, let's download the land cover map that we'll use as the basis for defining
32
32
the weights of our graph, and plot it. Graph weights correspond to the cost of
33
- an animal moving from one graph vertex to another. This is also commonly refered
34
- to as resistance in the context of connectivity modeling.
33
+ an animal moving from one graph vertex to another. This is also commonly
34
+ referred to as " resistance" in the context of connectivity modeling.
35
35
36
36
``` julia
37
37
url_base = " https://raw.githubusercontent.com/Circuitscape/datasets/main/"
@@ -51,8 +51,8 @@ plot(Raster("nlcd_2016_frederick_md.tif"), title = "Land Cover Type",
51
51
<img src='../figs/mdlc.png' width=500><br>
52
52
```
53
53
54
- Load the land cover data as a Raster, convert it to Float64, and read it into
55
- memory .
54
+ Load the land cover data as a Raster, read it into memory, then convert it to
55
+ Float64 .
56
56
57
57
``` @example corridors
58
58
landcover = convert.(
103
103
104
104
Now that we have a resistance raster, we can start using SpatialGraphs.jl!
105
105
106
- Convert the resistance raster into a ` WeightedRasterGraph ` :
106
+ Convert the resistance raster into a [ ` WeightedRasterGraph ` ] ( @ ref WeightedRasterGraph) :
107
107
108
108
``` @example corridors
109
109
wrg = weightedrastergraph(resistance)
@@ -117,7 +117,7 @@ the second argument to `dijkstra_shortest_paths`, correspond to the values in
117
117
wrg.vertex_raster.
118
118
119
119
First, we'll use ` dijkstra_shortest_paths ` to calculate to total cost distance
120
- from each vertex of interest to all other vertices in the graph
120
+ from each vertex of interest to all other vertices in the graph.
121
121
122
122
``` @example corridors
123
123
cd_1 = dijkstra_shortest_paths(wrg, 1)
@@ -126,7 +126,9 @@ cd_2 = dijkstra_shortest_paths(wrg, 348021)
126
126
127
127
Now, create placeholder rasters to store the cost distance values for each
128
128
vertex, and populate them using the cost distances calculated
129
- above. Finally, we'll sum the
129
+ above. Finally, we'll sum the rasters to enable us to delineate a corridor.
130
+ The value at each pixel corresponds to the total cost distance of the least cost
131
+ path between vertices 1 and 348021 that intersects that pixel.
130
132
131
133
``` @example corridors
132
134
# Create rasters
@@ -160,10 +162,10 @@ the cost distance. Let's get rid of those by setting them to the NoData value
160
162
of our raster.
161
163
162
164
``` @example corridors
163
- cwd_sum[cwd_sum .== Inf] .= -9999.
165
+ cwd_sum[cwd_sum .== Inf] .= cwd_sum.missingval
164
166
```
165
167
166
- Finally, let's plot the result! We'll use a threshold the set pixels above
168
+ Finally, let's plot the result! We'll use a threshold to set pixels above
167
169
a certain value to NoData, so we will only retain the pixels within our
168
170
"corridor".
169
171
0 commit comments