We have our maps laid out using hydrography maps from NOAA. We had to run the graphics through several steps to create the water feature raster. I have a process that pulls in that raster, sets a start and end point, and computes a Polyline which provides my distance between points. But we were getting strange results that had to be figured out. I added the cost array to the map and it is a regular, circular growth from the target point out. In a few places it appears to follow rivers but mostly it ignores the existance of land.

It reports values as being between 0 and 17xx. I'm concerned about the cost value of 0 as I though no raster can have a value of 0. So is this because I need to convert 0 to NoData? And if that is the case how do I do the conversion?

2 Answers 2


You can assign all '0' values to No Data in ArcObjects using the 'NoDataValue' property in IRasterProps. This is the easiest means of excluding a pixels containing a single value within a raster.

From the help, keep in mind:

These modifications only affect the in-memory raster representation and in no way change any of the raster dataset. You can persist the modifications to a new raster datast using ISaveAs::SaveAs or IRasterBandCollection::SaveAs

Outside of ArcObjects you can assign a no data value by exporting the raster file:

enter image description here


Well it turns out that the problem was not in our code. We read each hydrography layer out of a raster database. I guess a number of us assumed that the raster database contained pointers to the external maps that we display. WRONG.

The raster database contained very old versions which we then had to rebuild with what is currently in the database. Once we did that our cost rasters properly followed the waterway!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.