Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a large dataset of habitat information that I need to calculate distances from animal locations to the closest polygon of each habitat type. The way to do this, that I understand, would be to create Euclidean distance rasters for each habitat type. But in order to do this I need to break apart the original layer into many different parts. I can do this by "Select by attribute" and create a new layer for each one, but I was wondering if there was a tool that automates that and breaks apart a layer into multiple smaller layers by unique values in a column. If not, oh well, I'll get down to selectin' and creatin'.

Thanks in advance.


share|improve this question
It looks like its asking the same thing yeah. Not sure if I saw it or not, may have not scrolled down far enough past the Python script (which terrifies me, pretty new to all this) and missed the answers that I could have understood. Thanks for the link though. – HeidelbergSlide Jan 31 '13 at 23:22
Don't be terrified by the python code, its a lot simpler than it looks (trust me, I'm not a very experienced programmer myself). – Alexandre Neto Feb 1 '13 at 13:40
Hah, alright, thanks for the motivation. I'll have to spend a little time working around with it. – HeidelbergSlide Feb 1 '13 at 15:56
up vote 9 down vote accepted

Use a Feature Selection iterator in ModelBuilder. You can specify the field you want the selection to be grouped by (your field containing the unique values). It will iterate over your entire feature class, creating a selection layer from each unique value. You can then add more tools for the rest of your workflow.

enter image description here

share|improve this answer
This works like a charm. However, I'm really new to the Model Builder and I can't figure out how to get the Euclidean distance rasters to save themselves as unique path names and not get rewritten when the next one is created. If not, thanks a bunch for the help. – HeidelbergSlide Jan 31 '13 at 23:18
As mentioned in the other answer, you will need to use inline variables to ensure a unique output for each raster. Using the iterator's inbuilt variable Value (containing the name of the current input), you can set the path for all your outputs uniquely, e.g. for the output allocation raster you can put C:\Documents\Allocation_raster_%Value%, and for the distance raster you would put C:\Documents\Distance_raster_%Value%. – Cindy Williams-Jayakumar Feb 1 '13 at 5:03
Wonderful, that did the trick. Thanks so much. – HeidelbergSlide Feb 1 '13 at 15:55

Iterators would definitely help you here. Just in case you would need to export the feature classes on disk first, I attach the image I've created recently.

an example of splitting the roads feature class into multiple ones based on roadtype field

In case you don't want to bother with the model building, consider using Split by Attributes tool already compiled and available for use as a GP tool that does exactly the same thing as the model above.

share|improve this answer
Awesome, thanks so much. I had to give the green checkmark to Arabella because they posted first, but this works perfectly too. The additional advice on how to export the feature class was great. I am having an issue exporting the created Raster from Arabella's suggestion for Euclidean distance. They keep being overwritten when a new one is created. Any ideas? If not, no worries, thanks so much for the help. – HeidelbergSlide Jan 31 '13 at 23:20
Ah, no worries :) To avoid overwriting, I would also go for the Arabella's idea with inline variable substitution (…), it seems to be the best. – Alex Tereshenkov Feb 1 '13 at 7:42
Perfect, thanks for the link. Worked like a charm. – HeidelbergSlide Feb 1 '13 at 15:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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