# Calculate Euclidean distance to raster WITHIN multiple polygons

I am using ArcGIS 10.1 on a Windows x64 system.

I am working in a study area where I have 360 000 locations of about 50 territorial animals. I have a shapefile containing 125 sometimes overlapping polygons, representing the ranges of these territorial animals in my study area over several years. Each range is associated with multiple animal locations, that could be linked using "Animal ID" and "Year". Sometimes the ranges overlap a bit, even though animals are territorial - especially when an animal was monitored over several years.

I have 12 raster files that represent roads, habitat, etc - all habitat features - within my study area. I have calculated Euclidean distance rasters for each feature, because I want to know how far away each animal point is to each feature.

I have been using the "Extract Multi Values to Points" or "Extract Values to Points" tool to pull out the distance from each animal point to each feature type. (Extract Multi values to points is PAINFULLY slow, so sometimes I cheat and do each one separately using "extract values to points").

However, my problem: a territorial animal does not really have access to a habitat feature that occurs outside its range. It's "closest distance" to each habitat feature should be assessed INSIDE its range, because it's neighbouring territorial animal will prevent it from using any habitat outside its range! Therefore, I need a way to basically iterate through each animal ID, choose only the part of the feature raster that is overlapped with the range polygon, calculate euclidean distance to the feature (remember I have 12 features), and output the results to a table.

I am familiar with ModelBuilder and R, but not Python unfortunately.

Is there something I can do to process this task without taking two weeks out of my life and doing it manually?

• The basic method would be: loop through each animal, apply a selection to your habitat features, run Euclidean Distance on those selected features, and Extract Values to Points. I'm not sure how to achieve this in Model Builder (likely an iterator of some sort), but could give you a hand in Python. Also, I don't want to get into your business, but habitat features are often important exactly because they fall outside of the animal's range (e.g. roads may be a barrier). I assume you've thought all about it. Commented Jan 13, 2015 at 22:16
• Is there a way to "select raster features in polygon"? I know how to iterate in Model Builder, but I wasn't sure how I was going to get around the lenghthliness of clipping multiple rasters to the polygons and extracting the values to points...
– Nova
Commented Jan 14, 2015 at 2:04
• To clip a raster use 'extract by mask' resources.arcgis.com/en/help/main/10.1/index.html#//… (requires spatial analyst extension). This does sound like something that would suit python; if you're prepared to learn a little arcpy the results would be simpler (and easier to convey) than model builder. Commented Jan 14, 2015 at 2:47