I used a procedure which was vector based and consisted of the following steps:
- Create a buffer of the vectorized route (with a small distance, but a least 1 pixel)
- Create a buffer of the start and end points of the route (with a slightly larger buffer than the buffer around the route)
- Erease the buffer of the start and end points from the buffer of the route
- Use the remaining polygon to set NoData cells in the cost raster
Since your source and end points are raster, you can use the expand to create a raster holding the source and destination pixels and some pixels arround them. You also need the buffer of the route (or another expand raster on the raster that holds the pixels of the route) to combine them into a new cost raster.
What you want to do is create some map algebra that will do the following:
- When the expand of the source and destination cells is NoData,
- then verify if the route buffer is NoData, in that case assign the original cost raster values,
- else assign nodata.
- in case the expand source and destination cells have a value, you should assign the origina cost raster.
Suppose you have the following rasters:
- xpnd_src_dest (raster result of appyling the expand to the source and destination cells)
- xpnd_route (raster result of applying the expand to the route cells)
- cost_ras (your original cost raster)
- nd_ras (a raster containing only NoData cells, I have had many problems with the SetNull function, therefore I use an alternative)
The Map Algebra in the Raster Calculator would look something like:
Con(IsNull("xpnd_src_dest"), Con(IsNull("xpnd_route"), "cost_ras", "nd_ras"), "cost_ras")
This will yield a cost raster that you can use in the next run.
Kind regards, Xander