# Breaking apart a polygon layer by unique values, creating many new layers

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'.

Ayden

• Commented Jan 31, 2013 at 10:16
• 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. Commented Jan 31, 2013 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). Commented Feb 1, 2013 at 13:40
• Hah, alright, thanks for the motivation. I'll have to spend a little time working around with it. Commented Feb 1, 2013 at 15:56

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.
• 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%`. Commented Feb 1, 2013 at 5:03