How To Calculate The Shortest Possible Travel Distance To A Location When There Are Barriers To Movement That Mean Animals Cannot Simply Travel In A Straight Line

2,890 views
Skip to first unread message

GIS in Ecology

unread,
Jan 25, 2012, 4:29:18 PM1/25/12
to GIS In Ecology Forum
How To Calculate The Shortest Possible Travel Distance To A Location
When There Are Barriers To Movement That Mean Animals Cannot Simply
Travel In A Straight Line.

In ecology, it is often important to be able to work out the minimum
distance that an animal must travel to get between two locations. For
example, you may want to calculate the minimum distance an individual
animal must have travelled between two sightings locations, or the
minimum distance animals from two populations would need to travel to
mix. A straight, direct line distance can easily be done in ArcGIS
using tools such as the EUCLIDEAN DISTANCE tool that can be found in
the SPATIAL ANALYST extension.

However, this does not take account of possible barriers to the
movement of animals in a specific environment. For example, if you are
working with a marine species, and you are working near the coast, you
can run into a common problem. This is that the shorted straight-line
distance between two points may be blocked by land which animals
cannot cross. For example, in Scotland, the shortest straight line
distance between a sightings location of a marine species between the
Kessock Channel in the inner Moray Firth and Loch Broom on the west
coast of Scotland is approximately 90 km, but this goes straight
across mainland Scotland, which is not very suitable for marine
species since it is home to some of the highest mountains in
Britain! In contrast, the shortest route staying in the sea is about
four times longer at approximately 360 km that takes an animal up the
east coast of Scotland, along northern coast and then down the western
coast to reach Loch Broom. From an ecological point of view, this is
quite a difference and using the straight line distance would clearly
be inappropriate.

So, what can you do in such cases? A relatively easy work-around is
provided below. This work-around does require you to have some
familiarity with using ArcGIS 9.3 or 10 and that you have the SPATIAL
ANALYST extension. It will create a raster data layer where the value
of each cell is the minimum travel distance to a specific location for
a marine species taking into account the fact that the land will act
as a barrier to movements. So here goes:

1. Start with a new GIS project.

2. Set the projection/coordinate system for the data frame of your GIS
project to something suitable for measuring distances. For relatively
small study areas, I would recommend a transverse mercator projection
centred on the middle of your study area.

3. Add a polygon data layer of land (in the case of the example above
this would be a polygon data layer of the land areas of the British
Isles).

4. Add a new field called LAND to the attribute of this land polygon
data layer and use the FIELD CALCULATOR tool to add a value of one to
this LAND field.

5. Transform this polygon data layer into the same projection/
coordinate system as your data frame (this step is critical, you must
remember to do it otherwise the whole process will not work).

6. Convert this polygon data layer into a raster data layer using the
POINT TO RASTER conversion tool based on the LAND field. Make sure
that you set the extent within the tool so that the raster data layer
you produce will cover the whole of your study area.

7. Use the RECLASSIFY tool to change the cells with the number 1
(those that are on land) to No Data and the No Data values (which are
the sea) to a value of 1. This gives you a raster data layer that has
a value of 1 for each grid cell in the sea and a No Data value for all
cells on land.

8. Add a point data layer of the location that you want to work out
the minimum travel distances to for your study area (in the example
above this would be the Kessock Channel).

9. Transform this point data later into the same projection/coordinate
system as your data frame (this step is critical, you must remember to
do it otherwise the whole process will not work).

10. Use the COST DISTANCE tool (under the DISTANCES menu in SPATIAL
ANALYSIS TOOLS) to create a raster data layer where the values are the
minimum number of sea cells that an animal would have to travel
through to get from any point of your study area to your specific
location. Make sure that you set the extent within the tool so that
the raster data layer you produce will cover the whole of your study
area. The easiest way to do this is to match it to the extent of the
raster data layer created in step 7.

11. Using the RASTER CALCULATOR tool (under MAP ALGEBRA menu in
SPATIAL ANALYSIS TOOLS) to multiply this grid by the size of your grid
cells in kilometres (e.g. 1 for a raster with a 1km grid cell, 5 for a
raster with 5km grid cells, or 0.5 for a raster data later with 500m
grid cells. This will give you a raster data layer to where the
values are the minimum travel distances from every point in your
specific location. The units for these measurements will in
kilometres. You can now use the information tool to find out the
minimum travel distance from any location in your study area (such as
Loch Broom in the example above) to your specific location (such as
the Kessock Channel) within crossing any land.

The most likely cause of any problems with carrying out this task is
setting an appropriate projection/coordinate system for your data
frame at the start, and forgetting to transform all your data layers
into this projection/coordinate system before you make any of the
raster data layers. In addition, you can sometimes find that your
measurements are several orders of magnitude out and have to be
divided by 100 or 1000. You can check out whether this has occurred
be using the measuring tool to get the approximate distance that you
should have got for minimum travel distances between a test point on
your raster data layer and your location of interest.

If you want to work out the minimum travel distance for terrestrial
species, with the sea acting as a barrier to movements, you would
follow the above instructions, but miss out step seven. Similarly,
you can use other features, such as lakes or rivers, as barriers if
you have suitable data layers. In the marine environment, you could
use a similar process to restrict movements to non-shelf waters only
(for oceanic species) or shelf waters (for neritic species). In these
cases you would need to use a depth raster data layer and reclassify
in an appropriate manner instead of the step seven outlined above.

If you need to calculate the distances to multiple locations you have
two choices. Firstly, if you only need to find the minimum travel
distance to the nearest of your sites, you can include multiple points
in your point data layer.

Alternatively, if you need to find out the minimum travel distances to
each of your multiple locations, you would simply repeat this process
for each specific location.

If you have a large number of locations this can be time consuming,
but if you are up to it, you can create a tool to do this process
automatically and batch process all your locations so that all your
data layers will be processed when you do something else. This is not
for the feint-hearted!

If you have any comments or further advice on this topic, feel free to
post them on this thread. Similarly, if you find any faults in these
instructions or want to ask any questions about them, please post your
queries on this thread.

Antonella Rivera

unread,
Nov 7, 2012, 6:43:12 AM11/7/12
to gis-in-eco...@googlegroups.com

Hi everyone,

 

I had the same problem when I was doing this. In my case, it was due to possibility 2. A few of my dots fell within the no-value areas of the raster. I used the Add control points tool in the georeferencing toolbar to move my initial polygon data layer slightly to one side and then repeated steps 6-13. This worked for me.

 

I hope this helps,

 

Antonella



On Tue, Nov 6, 2012 at 7:31 PM, GIS in Ecology <cdma...@gisinecology.com> wrote:
Hi Ewan,
 
I'll need to have a think about what might be going on here, but there are two quick possibilities you can try.  The first is to double-check the projection/coordinate system of your St. Kilda data layer (just to make sure it's in the same one as the raster data layer and the data frame you're doing everything in).  You can do this by right clicking clicking on the name of the data layer in the TABLE OF CONTENTS window and selecting PROPERTIES.  The information can be found under the SOURCE tab, and then check the projection/coordinate system of the data frame. However, by the sounds of it you've already checked this as a possibility and ruled it out.
 
The second one is to make sure that yoru St. Kilda location falls within a grid cell with a value of one in your raster data layer.  It may be that your point falls in a grid cell that has a no data value (since it's a point on land), which would cause problems when you run the COST DISTANCE tool.  If this is the case, you'd need to make sure that the point marking the locations of St. Kilda falls in a cell with a value of 1.  This can either be done by moving it slightly to one side, or by removing the polygon that represents St. Kilda before you make the raster data layer in step 6.  
 
Try looking into this second possibility, and let me know if this makes any difference. In the mean time, I'll see if I can think of any other possible reasons (although I'm teaching all week so I might not get round to this until the weekend - is this too late for you?).
 
If anyone else has any suggestions, feel free to pitch in with them.
 
All the best,
 
Colin
 

On Tuesday, November 6, 2012 12:51:37 PM UTC, Ewan Edwards wrote:
Hi Colin,

The description here is excellent, however I seem to be hitting a brick wall at point 10: i.e., when I try to calculate the cost distance from all raster cells to my point (in this case, a single point at St Kilda), the output raster values are from 0 to 0.

Please see attached screenshots:

The area of my raster, and point location to calculate distances to, in North Pole Lambert Azimuthal Equal Area projection

A screen shot of step 10 from your instructions.

The resulting raster, with values from 0 to 0 and unable to view its attribute table

I look forward to hearing from you if you think you can help!

Ewan

--
-- ======================================================================
You received this message because you are subscribed to the "GIS In Ecology Forum" discussion group (http://www.gisinecology.com/GIS_in_Ecology_forum.htm).
 
To control how often you get emails from this group, go to http://groups.google.com/group/gis-in-ecology-forum/subscribe (you will need to log on to get to this page).
 
To post to this group, either log onto the group's home page or send an email to
gis-in-eco...@googlegroups.com.
 
The rules for posting to this group can be found here: http://groups.google.com/group/gis-in-ecology-forum/browse_thread/thread/df31a0822742203f#.
 
To unsubscribe from this group, email:
gis-in-ecology-f...@googlegroups.com
 
All information on this forum is provided on an 'as is' basis. GIS In Ecology is not responsible for checking the accuracy or suitability of any posting or response.
======================================================================
 
 

Ewan Edwards

unread,
Nov 7, 2012, 9:44:39 AM11/7/12
to gis-in-eco...@googlegroups.com
Colin,

You're a star, it was that the point was situated over land (i.e. NoData), as you suggested it might have been. Makes perfect sense. Locating the colony position just on the seaward side of the coast solves this. Thanks so much for your help

Ewan
--
Ewan W. J. Edwards

MASTS PhD Student
University of Aberdeen

Tel: +44 (0)7979 334381

Rory

unread,
Aug 8, 2013, 10:54:45 PM8/8/13
to gis-in-eco...@googlegroups.com
Hi Colin,
I am not sure if you would still be following this thread a year on, however I have successfully used your methodology to create cost distance rasters and hence work out distances for 85 points (from each point to the next) dotted around coastline on water.  Do you have any ideas how to plot the actual cost paths on the the ArcGIS map?

Thanks,

Rory

On Thursday, 28 June 2012 00:48:53 UTC+10, GIS in Ecology wrote:
Hi Antonella,
 
Thanks for ths posting.  Since you have a large number of locations that you want to get distances to, I would suggest the following:
 
Firstly, create a new empty folder on yoru C:/ drive where you will save all your data layers (your going to end up with a lot of them, so its best to keep them al in once place otherwise things will get messy).
 
Next, follow the instructions up to step 7 of the original version (this creates your grid that identifies which areas are in sea and which are not), and then follow these slightly ammended ones.
 
8. Add a point data layer with all your locations and transform it into the appropriate projection/coordinate system.
 
9. Separate your point data layer within all your locations into individual feature data layers so that you have just one location in each new data layer.  To do this, first make sure that each data point has a unique ID number associated with it (this needs to be a whole, positive integer - if you don't have this, it's best to add it before you add your point data layer). You can then split your data layer based on this unique ID number.  There are a number of possible tools for doing this.  The one I would recommend would be in Geospatial Mocdelling Environment (see http://www.spatialecology.com/gme/splitdataset.htm) if you are using ArcGIS 10, or the Split Vector Layer By Unique Value Field in Hawths Tools if you are using ArcGIS 9.3.  If you want to do it all in ArcGIS itself, you can find scripts that will help at http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=37AEB018-1422-2418-A036-CA6D9920F808 (for ArcGIS 10) and http://arcscripts.esri.com/details.asp?dbid=14127 for ArcGIS 9.3.  I haven't used these scripts myself as yet, and you may find that there is an upper limit to the number of new data layers you can create from the original data layer.  If this is the case, break your data down into smaller sets before applying the tool.  Make sure all the new data layers you create are saved to your empty folder on your C:/ drive
 
10. The next step is to use the COST DISTANCE tool to create the distance rasters to each point.  However, unlike in the original step, you will use batch processing.  Batch processing allows you to run a tool repeatedly without having to be sitting in front of your computer. To do this, in the ArcToolbox window, select the COST DISTANCE tool but don't open it.  Instead, right-click on it to open the COST DISTANCE Batch grid.  In this grid, select the data layer with your first location (and only that location) in it under the INPUT RASTER OR FEATURE SOURCE DATA LAYER. If this data layer is not loaded into your GIS project (and it doesn't have to be), right click on the box for this field and select BROWSE. Once you have selected the right point data layer for your first location, select the raster data layer created in step 7 under INPUT COST RATSER.  Finally, select where you want to save your distance raster data layer, and what name you want to save it under, in the OUTPUT DISTANCE RASTER field (make sure that they are saved in the folder that you are using for this process and that the name is the Unique ID for that specific location) . Now you need to repeat this for every other point data layer with a location in it.  Finally, before you run the tool, you need to set the extent of the data layer you wil create.  Click on the ENVIRONMENTS button at the bottom right of the tool window and select teh PROCESSING EXTENT so that it is the same as the raster created in step 7. Finally click OK to batch run the tool.  With a lot of locations this may take a long time and it can be best to set it running in the evening and come back to it the next day (but make sure that you have changed the settings on your computer so it doesn't go into hibernation if it senses you are not there for too long!).
 
11. You now need to extract the values from all these cost distance rasters to your original points.  This is done with the SAMPLE tool (SPATIAL ANALYST TOOLS> EXTRACTION> SAMPLE). Select all your cost distance raster data layers created in step 10 as the INPUT RASTERS (if they are not loaded into your GIS project, you can browse to them to select them from where they are stored).  Once they are all loaded in, select the point data layer with all your locations in it (this has to be the one that is in the projection/coordinate system you are using for your project) for the INPUT LOCATION RASTER OR POINT FEATURE section of the tool window.  Now set it to save the table that will be created in the appropriate folder by filling this information in in the OUTPUT TABLE section.  Finally, click OK to run this tool.  This will produce a table with the location ID numbers (as reflected in the name of each raster data layer) along the top, and with each row reflecting a different location.  The values in the cells will then be the distance between each individual pair of points.  Again if you find that you reach the maximum number of layers you can process, break it down into smaller batches.
 
12. Check that this process has worked properly by checking that the distance from each point to itself is zero.
 
13. Now you need to convert these values into the actual distances. This is done by opening your table in something like Excell 2007 or later (not Excell 2003 as it can't handle more than 256 fields). Add a new sheet and then apply the conversion formula (se the original step 11) to convert the values in the first sheet into the correct values in the second sheet (this formula will look something like =Sheet1B2 * Converstion Factor for cell B2).
 
This should give you the required table with the distances between all the locations. if you need the information in a different arrangement, you can create a macro in Excell to help you do this.  It won't necessarily be quick, but by using the batch processing, you can run a lot of it while you are doing something else.
 
Let me know if this works (or indeed if it doesn't - I can see if I've missed something out or got something wrong as I'm writing this without having tried it out in full myself so the instructions may need some tweaking).  Similarly, if anything is unclear, let me know and I can try and clarify it.
 
Good luck!
 
All the best,
 
Colin
 

On Wednesday, June 27, 2012 10:49:14 AM UTC+1, Antonella wrote:
Thanks for the information! I tried it for 1 point and it was very useful. However, I'm having trouble with this process because I have many locations (over 500) and I need to measure the distances among all of them. Could you elaborate on how I can" create a tool to do this process automatically and batch process all my locations"?

The end result I need to obtain is an output table (like the one given by the point-distance tool) of all the distances among points, calculated only through water.


Thank you for your help.

 
Message has been deleted
Message has been deleted
Message has been deleted

GIS in Ecology

unread,
Aug 10, 2013, 6:29:42 AM8/10/13
to gis-in-eco...@googlegroups.com
Hi Rory,
 
If you want to calculate tha actual cost paths, you will need to do some further processing after calculating the COST DISTANCE raster data layers. This involves creating a backlink raster and then a cost path raster. These are relatively easy to do within ArcGIS using the COST BACK LINK tool (SPATIAL ANALYST TOOLS> DISTANCE> COST BACK LINK) and the COST PATH tool (SPATIAL ANALYST TOOLS> DISTANCE> COST PATH).  These tools are relatively straight forward to use, but if you get stuck with any of them, let me know.
 
As with the COST DISTANCE tool, you can use the BATCH PROCESSING option to create multiple COST PATHS all at once.

Rory

unread,
Aug 14, 2013, 9:19:02 PM8/14/13
to gis-in-eco...@googlegroups.com

Hi Colin,

Thank you for your prompt reply.  I am having difficulty in achieving a final result of some cost paths (or what I am really after is the lines that the cost distance is being measured by to plot on my map).  I have been using the batch file method, but for this purpose I have tried using the normal one off method of simply opening the tool with a double left click.  I presume in the “Input raster or feature source data” section I would navigate to my source data all points?  “Input Cost raster” would be for argument sake point No.1 cost raster?

 

Then for the Cost path calculation for point No.1 to all other points the “Input raster or feature destination data” would again be the all points shape file (point file) with destination field referring to the No. of each point in question (1 thru 85) then the “input cost distance and input cost backlink raster areas would be for the respective rasters for point No. 1 that have been calculated earlier?

 

I presume the path type should be for each cell?

 

One problem I am facing using this whole method is however that the original distance table (that I get from step 11 in your methodology) seems to be reporting distances with errors of around 20 km out for points that should be around 600m apart with straight lines (not going around any land) and around 11km out when going around land and around 137 Km apart.  Could this is comparing table lengths with the measure tool snapping to points in ArcMap.  The data is projected to GDA94 mga ZONE 55 south (so distance are natively in metres). I presume differences in calculated versus measure with measure tool could be because of calculated can only go N,E,S,W and not diagonally through the raster cells using the cost distance tool?

 

Thanks in advance,

 

Rory

GIS in Ecology

unread,
Aug 20, 2013, 2:53:18 PM8/20/13
to gis-in-eco...@googlegroups.com
Hi Rory,
 
>>Thank you for your prompt reply.  I am having difficulty in achieving a final result of some cost paths (or what I am really after is the lines that the cost distance is being measured by to plot on my map). 
 
Once you have the whole cost path analysis working, you can get a line on your map by converting the final cost distance raster into a feature data layer either by converting it to a line dorectly, or by converting it into points which are then joined together to make lines. However, you have to get to that point first.
 
>> have been using the batch file method, but for this purpose I have tried using the normal one off method of simply opening the tool with a double left click.  I presume in the “Input raster or feature source data” section I would navigate to my source data all points? 
 
Yes.
 
>>“Input Cost raster” would be for argument sake point No.1 cost raster?
 
Yes.
 
>>Then for the Cost path calculation for point No.1 to all other points the “Input raster or feature destination data” would again be the all points shape file (point file) with destination field referring to the No. of each point in question (1 thru 85) then the “input cost distance and input cost backlink raster areas would be for the respective rasters for point No. 1 that have been calculated earlier?
 
Yes.
 
>>I presume the path type should be for each cell?
 
Yes.
 
>>One problem I am facing using this whole method is however that the original distance table (that I get from step 11 in your methodology) seems to be reporting distances with errors of around 20 km out for points that should be around 600m apart with straight lines (not going around any land) and around 11km out when going around land and around 137 Km apart. 
 
Okay, this is clearly a problem (and is the reason you should always check things to make sure they've worked properly!).  It could be down to the size of the grid cells you are using. The larger the cell sizes, the less accurate the measurements will be. However, even then it would be unlikely to be generating such a larger error.
 
The things I would suggest checking are:
 
1. That all the data layers and the data frame are in the same projection/coordinate system (which by the sounds of it you have already done).
2. That the grid cell size is appropriate for the distances which you are looking to measure (in particular check if you get more accurate measurements using a smaller cell size).
3. Check that you have done the calculation to convert from number of cells to distance properly (step 11).
 
>>Could this is comparing table lengths with the measure tool snapping to points in ArcMap.  The data is projected to GDA94 mga ZONE 55 south (so distance are natively in metres). I presume differences in calculated versus measure with measure tool could be because of calculated can only go N,E,S,W and not diagonally through the raster cells using the cost distance tool?
 
The cost distance tool can go diagonally as well  just N, E, W and S so this can't be the source of the problem.
 
If you are still having a problem with getting accurate distances and you can't work out what's going wrong after double-checking everything, there's a way round it. The first is to create the cost path raster, and then convert it into a line data layer using the RASTER TO POLYLINE tool (CONVERSION TOOLS> FROM RASTER> RASTER TO POLYLINE). You can then calculate the length of the lines using the CALCULATE GEOMETRY tool (accessed by opening the attribute table of a feature data layer and then right-clicking on the field you're going to calculate the length in and then selecting CALCULATE GEOMETRY). This will provide an alternative measure of the path length.
 
If this is still giving you problems, and you're happy to send me your data, put it in a zip file and email it to me at cdmacleod [at] GISinEcology.com and I'll take a look at it to see if I can work out what's wrong. It will take me a few days to get round to it, but once I get the time it shouldn't take too long.
 
Hope this helps.
 
All the best,
 
Colin

 

Thanks in advance,

 

Rory 

Kathryn Wiltshire

unread,
Nov 29, 2013, 12:11:36 AM11/29/13
to gis-in-eco...@googlegroups.com
Hi,
I have a point layer of records of marine introduced species occurrences from annual surveys. Each point is for a 100m transect and contains a relative abundance score (0-6) and I have points for 8 successive years (with a field for record year). I'd like to compare distances for each of two species from one year to the next, e.g. for 2004, I'd like to work out the distance of positive species sightings from where these were in 2003 as an indication of spread of the species. I've successfully made the raster layer to "mask out" islands in the area, and I made a cost distance raster, but I would assume this is showing cost distance for all points in my layer to their nearest neighbour? Is there a way to specifically compare 2003 to 2004 points? I don't want the distances between points from the same year. To complicate matters, for some years there are ~2000 data points. I have ArcGIS 10.1 with Arc View license and access to spatial analyst.
Thanks for any advice you can provide
Kathryn

GIS in Ecology

unread,
Dec 3, 2013, 6:34:53 AM12/3/13
to gis-in-eco...@googlegroups.com
Hi Kathryn,
 
This is quite an interesting problem and it might take a little while to work out the best way to solve it, but there should defintiely be a relatively simple solution in there somewhere.
 
Firstly, a couple of  backgound questions so that I'm sure I'm understanding what you want to do. If a transect is positive in one year, does that mean the same transect will definitely be positive the next time it is sampled? If this is the case, you have what is effectively an invasion front. If not, you'll have a more mosaiced pattern of spread. Depending on which you have, you would want to handle thje process differently in GIS.
 
Also, for a point which is positive in one year, do you want to work out the closest point which was positive the previous year (i.e. where it most likely came from)? Or do you want to work out the lagest distance between a positive point in one year, and  a positive point in the previous year (i.e. the maximum distance of spread)?
 
In terms of the spread, are you only wanting to compare one year to the next (i.e. look at shifts from year to year) or do you want to be able to compare all years (e.g. compare 2003 to 2008, and not just 2004).
 
Finally, can you tell me a bit about the ecology of the species you're working with (e.g. is it sessile or motile, benthic or pelagic etc.) and what sort of scale you are studying this at (i.e. one estuary, one country, one ocean)?
 
If you can let me know the answer to these these, I can advise on how best to work out how to get the information you're looking for.
 
All the best,
 
Colin 

Kathryn Wiltshire

unread,
Dec 3, 2013, 6:38:23 PM12/3/13
to gis-in-eco...@googlegroups.com
Hi,
Thanks for looking at this problem. I probably need to think a bit more about exactly how to look at the data, but my main interest is in comparing successive years, so 2004 too 2003, 2005 to 2004 etc, and in the maximum distance spread. The pattern of spread is mosaic like, so not all positive records will be definitely positive the following year (and transects, although covering the same overall area, do not correspond exactly in their start-end points from one year to the next). However, there are a couple of years where the range of the species actually reduced rather than expanded, so it would probably make sense to compare each year to the first (2003), but I wouldn't worry about doing all inter-year comparisons. Visualising the data in ArcGIS it is clear one of the two species was already widespread to begin with, so I will probably only do this for the other species. The maximum number of positive transects for this species in a year is in the few hundreds, so not as many points as I thought I might be dealing with, but still a lot. The species is actually an algae, so not motile as such, but it can spread by fragmentation, and it is likely that fragments carried by currents (or possibly moved by boats) established new outbreaks. It grows on mud/sand substrates, which are present throughout the area. The area is a single estuary that is essentially Y-shaped with the two arms of the Y opening to the sea and separated by a couple of islands, so to spread from one arm of the "Y to the other, the species would have to move in the order of 10-15 km, although the points may be <1 to 2 km "as the crow flies". (It's unlikely human activity moved it directly across the islands, these are largely mangrove-covered and inaccessible, there are no roads/paths across). The species was initially found at the base of the "Y" then near the junction and has moved up both arms, but not with a continuous distribution.
Hope this helps, let me know if you need further detail
Regards
Kathryn

GIS in Ecology

unread,
Dec 8, 2013, 6:49:20 AM12/8/13
to gis-in-eco...@googlegroups.com

Hi Kathryn,

 

Sorry to take so long to get back to you on this. However, it’s a relatively complex problem and I needed a bit of extra time to think about it.

 

If you were working with a species where there was a simple invasion front, this would be relatively straight forward. However, since your species distribution is more of a mosaic, it makes things a bit more complicated.

 

I’m going to assume that you have a point data layer of where the species was recorded along each transect. In the original instructions here, it assumed that you were starting with a single point location. However, you can also use a data layer with multiple point locations as your starting point. Thus, if you start by creating a cost distance raster layer based on all the locations where the species was recorded in your first year (2003). You’d then repeat this until you have cost distance raster data layers based on the locations where the speies was recorded in each of the other years.

 

Next, starting with the points where your species was recorded in 2004, use the EXTRACT MULTI VALUE TO POINTS tool (SPATIAL ANALYST TOOLS> EXTRACTION> EXTRACT MULTI VALUE TO POINTS) and extract the cost distance values for the raster data layers for all the other years. This will give you a matrix of the minimum distance between each location where the species was recorded in 2004, and where it was recorded in all other years. You can then sort the data descendingly based on the distances for eaech year, and read off the maximum value. This will tell you the longest by sea distance between a presence point in 2004 and in each of the other years. Repeat this for all other years.

 

Now, there’s a couple of things you need to be aware of here. Firstly, this is makig an assumption that a new location was colonised from the nearest other location occupied in the previous year. This may not be biologically valid, and because of currents and tides, and you might find that the actual colonisation locations differ from the nearest ones. This means your maximum colonisation distances could be an under-estimate.

 

Secondly, the greatest distance travelled is just a single measurement, and as such it is potentially vulnerable to biases from the presence of outliers. As a result, you might be better using something like the average of the longest five distances moved, or something similar.

 

As an alternative to just measuring distances travelled, you might also want to consider doing something like a kernel analysis (again using barriers). This would allow you to identify which areas have been occupied throughout all the years and which new areas have been occupied in successive years. Kernel density estimates have traditionally been done on data from individual animals, but there’s no reason why you cannot do it for individual species. You can find out about using kernels on this posting here: https://groups.google.com/forum/#!searchin/gis-in-ecology-forum/home$20range/gis-in-ecology-forum/k13R3rNpXts/A5mV4C_HkWEJ

 

Anyway, I hope this helps, and if you have any further questions, or if any of this isn’t clear/doesn’t work, just let me know.

 

All the best,

 

Colin


 

Silvia

unread,
Mar 7, 2014, 5:32:49 AM3/7/14
to gis-in-eco...@googlegroups.com
Hi Colin,
thanks for helping with this subject!!! I read all the posts but I'm still not able to perform my analyses. I have 37,400 points and I have to calculate for all of them the closest distance to various features (for example, the closest distance to the closest fishing port, or to the closest fish farms, etc.). So the closest distance is not referred to a specific spot but ArcGis has also to find which is the closest spot. So my goal is to have – thanks to an automated process – a table with the list of all my points and the related closest distance to ports/farms/etc., calculated only through water.
Thanks for your help,
Silvia

GIS in Ecology

unread,
Mar 7, 2014, 8:53:46 AM3/7/14
to gis-in-eco...@googlegroups.com
Hi Silvia,
 
Sorry to hear you're having problems with this.
 
In your case, rather than just find out the distance between two points, you want to find the distance between your sampling points (the 37,400 points) and another set of features (the points marking all the fishing ports for example). In this case, the process is basically similar to that outlined in the first post. When you get to step eight (8. Add a point data layer of the location that you want to work out the minimum travel distances to for your study area), the data layer you will add is the points making all the features you want to work out the nearest distance to (for example the one with all your fishing ports) and not just a single location. You then carry on with the rest of the instructions.
 
Once you have the cost distance raster for the first of your features, you would repeat this to create a second cost distance raster for your next set of features (e.g. all the fish farm locations, and so on until you have a cost distance raster for all the features you want to know the shortest distance to for you sampling points.
 
Finally, you can use the EXTRACT VALUES TO POINTS tool (SPATIAL ANALYST TOOLS> EXTRACTION> EXTRACT MULTI VALUES TO POINTS) to link the information from these raster data layers to your sampling points. This will add fields to the attribute table for your sampling points data layer wich contains a value for the shortest distance by sea to each type of feature. 
 
While this will give you the shortest distances by sea to the nearest feature of a specific feature type, it won't tell you which feature is the closest (i.e it will tell yo the shortest distance to the nearest port, but it won't tell you which port that is). If you need to do that, it would probably be quite a diferent, and much more complicated, process. 
 
Hopefully, this helps, and if it does please post a reply here to let others know. If it doesn't or if I've not understood what you are trying to know, just let me know and I'll try again.
 
All the best,
 
Colin  

Silvia

unread,
Mar 9, 2014, 5:43:35 AM3/9/14
to gis-in-eco...@googlegroups.com
Hi Colin,

you are great! Thanks a lot for your help!

I got stuck in few steps but I managed to solve the problems.

In case it might be helpful to other people:

- step 6: pay attention to "cell size”... My polygon study area was 129km by 60km. I left the cell size field as the program suggested (in my case 240) but it didn’t work: I could not see the raster layer on my map as everything was white. I tried 3 and 1, because I wanted to be extremely precise... although I could see now the raster layer it became impossible to handle it in the next steps. 50 was OK.

- step 10:  as already said in other posts... points/feature that were slightly “on land” prevented the calculation for the entire dataset; the only given value for all my points was zero. After removing them or change their position to be in the sea, everything worked well.

I did a manual check to compare the shortest distance calculated with the ruler-measure tool versus the automated process. The projection/coordinates system are the same, but sometimes the difference is almost null (1meter of difference or less: excellent!) other times up to 1,3km. The discrepancy seems to be random but ruler-measures are always smaller than the others. I thought that closest points would have less difference than those further away, but does not seem to be the case. Not sure how to handle this, but probably I do not need to be so picky ;-)

Thank you very much!!!!!!

Silvia

GIS in Ecology

unread,
Mar 10, 2014, 11:38:44 AM3/10/14
to gis-in-eco...@googlegroups.com
Hi Silvia,
 
Glad to hear this worked for you, and thanks for posting information about where you got stuck and how you got round the problems.
 
In terms of the cell size, remember that if you use a really small cell size, you migth have to play around a lot with the symbology or zoom in to actually see it properly (since you'll be dealing with very large numbers. Alternatively, it might just be that the raster data layers get too big (in terms of the file size) to be handled by the various tools.
 
In terms of the level of error, I'm not too sure what could be causinig this. One possibility is that this process assumes that the route passes through the middle of each grid cell, and this might make the estimated distance by sea slightly longer, but if this were the case, I'd have expected it to be greatest with the longer distances.
 
The other possibility is that there might be some small bits of land (e.g. small islands or narrow headlines) which have not been accurately captured when you converted the land polygon into a raster. This might lead to narrow channels becoming 'blocked', or channels being 'created' when the land raster data layer was created using the POLYON TO RASTER tool (I think I have this written as POINT TO RASTER in the original post on this thread rather than POLYGON TO RASTER). If this is happening, you would need to use a smaller cell size so that the land barriers are captured mro accurately. The way to assess whether this might be the cause would be to look at whether there is any spatial clustering in the errorrs. For example, you could look at whether there one part of the study area where the errors are always greater than others. If there is, then you can look back at the original land polygon, and compare it to the land raster to see if there is some feature which hasn't been captured properly.
 
Anyway, it's good that you are managing move forward on this, and if there is anything else I can help with, just let me know.
 
All the best,
 
Colin

Meagan

unread,
Jul 25, 2014, 11:03:25 AM7/25/14
to gis-in-eco...@googlegroups.com
Hi Colin,

I'm not sure if you're still monitoring this thread, but I wanted to thank you so much for posting the instructions on how to do this! It's been very helpful!

I do have a quick question for you about an issue I've encountered. In cases where the points don't have to go around land, I've noticed that the distances using Cost Distance are slightly off (sometimes majorly off) from the distances using the Near tool. By using Cost Path, I've discovered that the tool does not take the shortest route, but rather finds it "cheaper" to move vertically, then diagonally (resulting in a two segmented line, instead of a straight path). Therefore, the distance is longer than if it was a straight line. Sometimes these differences are as much as 100 km between what Near would give you and what Cost Distance would give you (in situations without having to go around land).

I'm wondering if you have a way to resolve this. For example, is there a way to make the cost path be calculated using the shortest path (like Near) instead of the segmented line that it travels?

Thanks so much,
Meagan

GIS in Ecology

unread,
Jul 25, 2014, 12:15:14 PM7/25/14
to gis-in-eco...@googlegroups.com
Hi Meagan,
 
You raise an interesting point here. If you don't have to go round land to find out the distance between two points, I probably wouldn't follow this procedure, but rather use a different approach (e.g. by calculating a DISTANCE raster or using the NEAR tool). This is really just a work around for situations where there is a barrier to movements of some kind and you need to be able to work out distances between points.
 
You are right that the cost path tool doesn't do diagonal moves, but one up and then one across, to create its cheapest path. If you are getting major artefacts from this process, the simplest answer would be, in theory at any rate, to use smaller grid cells for your cost grid. The smaller the cell size, the lower the level of the artefact created by this approach will be. This is because as the cell size does down, the closer the cost path route will be to a vector route which the NEAR tool uses. However, I'm not too sure how much this would improve things in practice.
 
As far as I know, there isn't any other way to calculate the shortest distance betwen points when there is a barrier to movement in the way, but if you have any suggestions, feel free to post them here.
 
Just out of interest, when you're getting errors up into the 100kms, over what sort of distance is this (i.e. what distance is the NEAR tool giving you)? 
 
Anyway, thanks for pointing this out. It's something that people do need to be aware of, and I might have to do a bit of thinking about exactly what the implications of this are under different circumstances and when comparing routes measured directly and using this approach.
 
All the best,
 
Colin

Meagan

unread,
Jul 25, 2014, 12:54:59 PM7/25/14
to gis-in-eco...@googlegroups.com
Hi Colin,

Thanks for the quick reply!

My issue is that some points need to go around land (e.g., measuring distance between a polygon off of North Carolina and points in the Gulf of Mexico) and some don't (e.g., measuring distance between a polygon off North Carolina and points off the coast of Florida). So I'm not sure that using two different methodologies is a good idea in this situation.

I will try with smaller grid cell sizes, but I got similar results when using 25 m grid cells vs. 1 km grid cells. The example that was 70 km off was a point that should have been ~650 km from the polygon (when measured using Near) and didn't have to go across land. But, I compared all of my points and there is a large range of how far "off" they are. For example, points that are directly vertical or horizontal from a polygon edge are almost the same distance as Near calculates, but points that are off of a corner of the polygon are very different (because Cost Distance has to move in that diagonal side-stepping way to get there).

I'm wondering if some sort of smoothing might help? So, make the cost path and then smooth it to get rid of these steps? Is that a possibility when I have thousands of points (and therefore paths) that I'm measuring? What do you think?

Thank you!
Meagan

GIS in Ecology

unread,
Jul 26, 2014, 7:08:15 AM7/26/14
to gis-in-eco...@googlegroups.com
Hi Meagan,
 
I did wonder whether the smaller grid cells might only work in theory and not in practice. I guess the main issue is, as you point out, when you get some paths which are directly vertical or horizontal and others which are directly diagonal (which will potentially add on up to about 40%).
 
I've been going back and looking at how the cost path/cost distance tool works, and I think I had it the wrong way round in my head. The tool does allow fro true diagonal movements (see here: http://resources.arcgis.com/en/help/main/10.1/index.html#/Understanding_cost_distance_analysis/009z000000z5000000/) rather than moving up and one across. This means the error for diagonal movements shouldn't come from adding two units when it should only be 1.4, but rather from treating a diagnonal movement as 1 when it should be 1.4 (where one is the cell size). This means that diagonal distances should be about 40% lower than the actual distance. Is this what you are finding, or are you finding that the diagonal distances measured with this process is longer than the actual distance? If I know the direction of the error, this will help with working out what's going on and, therefore, how to solve it.
 
If it is under-estimating the distances, then there should be a workaround. This would be to try converting the cost raster data layer into a line (using the RASTER TO POLYLINE tool) and then calculate the length of this line using the CALCULATE GEOMETRY tool. Give this a go and let me know whether this produces a more accurate result (there's a possibility that the RASTER TO POLYLINE took won't work properly to produce a continuous line for diagonal distances). If it does, it should be possible to automate the whole process. If not, I'll see if I can come up with a different workaround. 
 
All the best,
 
Colin
 

On Friday, July 25, 2014 5:54:59 PM UTC+1, Meagan wrote:
Hi Colin,

GIS in Ecology

unread,
Jul 28, 2014, 7:18:38 AM7/28/14
to gis-in-eco...@googlegroups.com
IMPORTANT UPDATE TO THE INSTRUCTIONS PROVIDED ON THIS THREAD:
 
In the original instructions for calculating the shortest travel distance, step 11 says that to work out the shortest distances, you needed to use the raster calculator tool to multiple the COST DISTANCE raster data layer created in step 10 by the cell size to get the actual distance. This is incorrect. As long as the raster data layer you created in step 7 has a value of 1 for all the cell values which are in the sea, the output ot he COST DISTANCE tool will be a raster data layer where the values are the actual distances in metres (as long as you are working in a projected coordinate system where the map units are in metres). Therefore, you not should do step 11. 
 
Also, the smaller the cell size that you use, the more accurate your distance measurement will be. This is because the path is routed through the centre of each grid cell in your raster data layer.
 
Appologies for any problems caused by this error in the original instructions.
 
All the best,
 
Colin
Reply all
Reply to author
Forward
0 new messages