-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
r.connectivity.distance bugfix #1091
Open
ecodiv
wants to merge
5
commits into
OSGeo:grass8
Choose a base branch
from
ecodiv:r_connectivity
base: grass8
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
93e87c1
r.connectivity import ogr
ecodiv 40ce90a
r.connectivity.distance bugfix
ecodiv 33b5abe
Merge branch 'OSGeo:grass8' into r_connectivity
ecodiv 18b7595
remove commented code
ecodiv e1c3cab
Merge branch 'r_connectivity' of github.com:ecodiv/grass-addons into …
ecodiv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,32 +1,43 @@ | ||||||||||||||
<h2>DESCRIPTION:</h2> | ||||||||||||||
<em>r.connectivity.distance</em> computes cost-distance between all | ||||||||||||||
|
||||||||||||||
<em>r.connectivity.distance</em> computes cost-distances between all | ||||||||||||||
areas (patches) of an input vector map within a user defined Euclidean | ||||||||||||||
distance threshold. | ||||||||||||||
|
||||||||||||||
<p>Recently, graph-theory has been characterised as an efficient and | ||||||||||||||
useful tool for conservation planning (e.g. Bunn et al. 2000, | ||||||||||||||
Calabrese & Fagan 2004, Minor & Urban 2008, Zetterberg et. al. 2010).</p> | ||||||||||||||
<p> | ||||||||||||||
Recently, graph-theory has been characterised as an efficient and | ||||||||||||||
useful tool for conservation planning (e.g. Bunn et al. 2000, Calabrese | ||||||||||||||
& Fagan 2004, Minor & Urban 2008, Zetterberg et. al. 2010). | ||||||||||||||
|
||||||||||||||
<p>As a part of the r.connectivity.* tool-chain, <em>r.connectivity.distance</em> is | ||||||||||||||
intended to make graph-theory more easily available to conservation | ||||||||||||||
planning.</p> | ||||||||||||||
<p> | ||||||||||||||
As a part of the r.connectivity.* tool-chain, | ||||||||||||||
<em>r.connectivity.distance</em> is intended to make graph-theory more | ||||||||||||||
easily available to conservation planning.</p> | ||||||||||||||
|
||||||||||||||
<p><em>r.connectivity.distance</em> is the first tool of the | ||||||||||||||
r.connectivity.*-toolchain (followed by <em>r.connectivity.network</em> | ||||||||||||||
<p> | ||||||||||||||
<em>r.connectivity.distance</em> is the first tool of the | ||||||||||||||
r.connectivity.*-toolchain (followed by <em>r.connectivity.network</em> | ||||||||||||||
and <em>r.connectivity.corridors</em>).</p> | ||||||||||||||
|
||||||||||||||
<p><em>r.connectivity.distance</em> loops through all polygons in the | ||||||||||||||
<p> | ||||||||||||||
<em>r.connectivity.distance</em> loops through all polygons in the | ||||||||||||||
input vector map and calculates the cost-distance to all the other | ||||||||||||||
polygons within a user-defined Euclidean distance threshold.</p> | ||||||||||||||
|
||||||||||||||
<p>It produces two vector maps that hold the network:</p> | ||||||||||||||
<p> | ||||||||||||||
It produces two vector maps that hold the network: | ||||||||||||||
|
||||||||||||||
<p> | ||||||||||||||
<ul> | ||||||||||||||
<li>an edge-map (connections between patches) and a</li> | ||||||||||||||
<li>vertex-map (centroid representations of the patches).</li> | ||||||||||||||
</ul> | ||||||||||||||
|
||||||||||||||
<p>Attributes of the edge-map are:</p> | ||||||||||||||
<table> | ||||||||||||||
<p> | ||||||||||||||
Attributes of the edge-map are: | ||||||||||||||
|
||||||||||||||
<p> | ||||||||||||||
<table border='1'> | ||||||||||||||
<tr> | ||||||||||||||
<td>cat</td> | ||||||||||||||
<td>line category</td> | ||||||||||||||
|
@@ -47,52 +58,62 @@ <h2>DESCRIPTION:</h2> | |||||||||||||
<td>cost-distance from from_patch to to_patch</td> | ||||||||||||||
<td>double precision</td> | ||||||||||||||
</tr> | ||||||||||||||
|
||||||||||||||
</table> | ||||||||||||||
<p>Attributes of the vertex-map are:</p> | ||||||||||||||
<table> | ||||||||||||||
|
||||||||||||||
<p> | ||||||||||||||
Attributes of the vertex-map are: | ||||||||||||||
|
||||||||||||||
<p> | ||||||||||||||
<table border='1'> | ||||||||||||||
<tr> | ||||||||||||||
<td>cat</td> | ||||||||||||||
<td>category of the input patches</td> | ||||||||||||||
<td>integer</td> | ||||||||||||||
</tr> | ||||||||||||||
<tr> | ||||||||||||||
<td>pop_proxy</td> | ||||||||||||||
<td>the user defined population proxy to be used in further analysis, | ||||||||||||||
representing a proxy for the amount of organisms potentially dispersing | ||||||||||||||
from a patch (e.g. habitat area)</td> | ||||||||||||||
<td>the user defined population proxy to be used<br> | ||||||||||||||
in further analysis, representing a proxy for<br> | ||||||||||||||
the amount of organisms potentially dispersing<br> | ||||||||||||||
from a patch (e.g. habitat area)</td> | ||||||||||||||
<td>double precision</td> | ||||||||||||||
</tr> | ||||||||||||||
</table> | ||||||||||||||
|
||||||||||||||
<p>On user request (<b>p-flag</b>) the shortest paths between the possible | ||||||||||||||
<p> | ||||||||||||||
On user request (<b>p-flag</b>) the shortest paths between the possible | ||||||||||||||
combination of patches can be extracted (using <em>r.drain</em>), along | ||||||||||||||
with start and stop points.</p> | ||||||||||||||
with start and stop points. | ||||||||||||||
|
||||||||||||||
<p>In addition, <em>r.connectivity.distance</em> outputs a cost distance | ||||||||||||||
raster map for every input area which later on are used in | ||||||||||||||
<em>r.connectivity.corridors</em> (together with output from | ||||||||||||||
<em>r.connectivity.network</em>) for corridor identification.</p> | ||||||||||||||
<p> | ||||||||||||||
In addition, <em>r.connectivity.distance</em> outputs a cost distance | ||||||||||||||
raster map for every input area which later on are used in | ||||||||||||||
<em>r.connectivity.corridors</em> (together with output from | ||||||||||||||
Comment on lines
+89
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
<em>r.connectivity.network</em>) for corridor identification. | ||||||||||||||
|
||||||||||||||
<p>Distance between patches is measured as border to border distance. With | ||||||||||||||
<p> | ||||||||||||||
Distance between patches is measured as border to border distance. With | ||||||||||||||
the <b>border_dist</b> option, the user can define the number of cells | ||||||||||||||
(n) along the border to be used for distance measuring.<br> | ||||||||||||||
(n) along the border to be used for distance measuring. | ||||||||||||||
|
||||||||||||||
<p> | ||||||||||||||
The distance from a (start) patch to another (end) is measured as the | ||||||||||||||
n-th closest cell on the border of the other (end) patch. An increased | ||||||||||||||
number of border cells used for distance measuring also increases the | ||||||||||||||
width of possible corridors computed with | ||||||||||||||
<em>r.connectivity.corridors</em> later on.</p> | ||||||||||||||
<em>r.connectivity.corridors</em> later on. | ||||||||||||||
|
||||||||||||||
<p>If an output directory is given for the <b>conefor_dir</b> option is | ||||||||||||||
specified, also output suitable for further processing in | ||||||||||||||
<a href="http://www.conefor.org">CONEFOR</a> will be produced, namely:</p> | ||||||||||||||
<a href="http://www.conefor.org">CONEFOR</a> will be produced, namely: | ||||||||||||||
<ul> | ||||||||||||||
<li>a node file</li> | ||||||||||||||
<li>a directed connection file, and</li> | ||||||||||||||
<li>an undirected connection file</li> | ||||||||||||||
</ul> | ||||||||||||||
|
||||||||||||||
<h2>EXAMPLES</h2> | ||||||||||||||
|
||||||||||||||
The following example is based on the North Carolina dataset! | ||||||||||||||
<p><em>Please be aware that all input parameters of the following example are | ||||||||||||||
purely hypothetical (though they intend to imitate a real life | ||||||||||||||
|
@@ -107,9 +128,9 @@ <h2>EXAMPLES</h2> | |||||||||||||
the borders are no suitable habitats.<br> | ||||||||||||||
It is not the most mobile of species and can cover (under optimal | ||||||||||||||
conditions) maximal 1.5 km. | ||||||||||||||
</p> | ||||||||||||||
|
||||||||||||||
<h3>Prepare input data</h3> | ||||||||||||||
|
||||||||||||||
Before we can run the connectivity analysis with the r.connectivity.*-tools | ||||||||||||||
we need to prepare the example input data. Because we want to use | ||||||||||||||
cost distance as a distance measure we have to provide a cost raster map | ||||||||||||||
|
@@ -137,10 +158,7 @@ <h3>Create input patch vector map</h3> | |||||||||||||
landuse96_28m==11,1,null())" | ||||||||||||||
|
||||||||||||||
# Vectorize patches | ||||||||||||||
r.to.vect input=patches output=patches feature=area | ||||||||||||||
|
||||||||||||||
# Add a column for the population proxy (in this case area in hectares) | ||||||||||||||
v.db.addcolumn map=patches layer=1 columns="area_ha double precision" | ||||||||||||||
r.to.vect input=patches output=patches type=area | ||||||||||||||
|
||||||||||||||
# Upload area to attribute table (later used as population proxy) | ||||||||||||||
v.to.db map=patches type=point,line,boundary,centroid layer=1 qlayer=1 \ | ||||||||||||||
|
@@ -190,9 +208,10 @@ <h3>Create a cost raster:</h3> | |||||||||||||
18 = 28 #Mixed Hardwoods/Conifers (1*resolution (28m)) | ||||||||||||||
20 = 42 #Water Bodies (1,5*resolution (28m)) | ||||||||||||||
21 = 84 #Unconsolidated Sediment (3*resolution (28m))' | r.reclass \ | ||||||||||||||
input=landuse96_28m output=costs rules=- --overwrite | ||||||||||||||
input=landuse96_28m output=costs rules=- | ||||||||||||||
</pre></div> | ||||||||||||||
|
||||||||||||||
<p> | ||||||||||||||
<div style="margin: 10px"> | ||||||||||||||
<a href="r_connectivity_distance_costs.png"> | ||||||||||||||
<img src="r_connectivity_distance_costs.png" width="600" height="600" | ||||||||||||||
|
@@ -221,6 +240,7 @@ <h3>Create the network</h3> | |||||||||||||
conefor_dir=./conefor | ||||||||||||||
</pre></div> | ||||||||||||||
|
||||||||||||||
<p> | ||||||||||||||
<div style="margin: 10px"> | ||||||||||||||
<a href="r_connectivity_distance_shortest_paths.png"> | ||||||||||||||
<img src="r_connectivity_distance_shortest_paths.png" width="600" | ||||||||||||||
|
@@ -230,6 +250,7 @@ <h3>Create the network</h3> | |||||||||||||
represented by shortest paths and patch areas, produced in the example above.</i> | ||||||||||||||
</div> | ||||||||||||||
|
||||||||||||||
<p> | ||||||||||||||
<div style="margin: 10px"> | ||||||||||||||
<a href="r_connectivity_distance_network.png"> | ||||||||||||||
<img src="r_connectivity_distance_network.png" width="600" height="600" | ||||||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.