Calculate distance from points to nearest raster cell of specific value

02-03-2014 07:39 PM
New Contributor

I have posted a similar thread in the Python forum. Surprisingly, it has received over 100 views, but sadly, no replies!

I need to find the distance from each point in a shapefile to the nearest raster cell with a specific value. The shapefile is a time series, so for each date, there might be one or more points. I have all the rasters per date of the points in the shapefile. So for each date, I need to link the data points from the shapefile to the corresponding raster of the same date and calculate the distance from each point to the raster cell value of a specific value (< = 15).

Is there a tool or python code to accomplish this?

Thank you,
0 Kudos
3 Replies
MVP Regular Contributor
I am not completely sure of the details, but what about converting your raster to points (maybe with a reclass to set some thresholds), and then run a spatial join between them, with the match option set to closest? You may need to do some selecting first, to limit the dataset matches. For example, select the raster points <= 15 prior to running the join, so the possible matches are limited to the subset of interest.
Best Regards,
0 Kudos
Occasional Contributor III
You can do this via the "Spatial Analyst Tools > Distance > Euclidean Distance" tool. However, since you want distance to a conditional value you will need to create a new raster representing the specific condition that you are after. In this case you can use the "Spatial Analyst Tools > Conditional > SetNull" tool or the raster calculator with the following statement:

SetNull("raster" > 15, "raster")

This will set all cell values > 15 to NoData and, as such, will not be considered in the distance analysis.
0 Kudos
New Contributor

What a relief to have your experience and creative problem solving in such a short time. THANK YOU!

I will try both options as suggested. Which brings me to another issue.

Essentially, this analysis is a 7-year time series; each year(.mxd) has a unique shiptrack of data with lat/lon points (and the main research data) to be compared to the corresponding values on the daily satellite products for the dates covered in the cruise. The length is usually around 40-90days, from each I have already extracted raster cell values I needed. So, my concern is, can each map's folder of satellite layers be converted efficiently, in batches? I don't have much experience with that process, and the last time I tried (years ago) it kept crashing arc. I think that was because the images are hemispheric (polar). It would be nice to keep them at that scale because I will need to do the same distance query for other cruises in other sub-regions.

You've made my day!
0 Kudos