I have 20.000 Assessment units 5x5km (Polygons) and a habitat map with 18 classes in different size and shape (see screenshot). Now I need to know the number and the kind of habitats within each assessment unit.
I did split the habitat map into single shapefiles by attribute and performed a spatial join (one to one) 18 times with the intersects option. However, smaller habitats that are within my target feature or bigger habitats that contain my target feature are ignored. Only the habitats that intersect with the boundary of my assessment units are used.
Whats the easiest and quickest way to sort this problem out? Your help is really appreciated. Thanks! Manu
If I understand correctly you are looking to find how many types / kinds of habitat fall within each of your grids?
I think one of the ways would be to try the following:
1) Make sure your grid has a unique identifier field - possibly create a field called DISSOLVE and using the field calculator add in the FID to the new field. 2) Run an intersect between the grid and the habitat dataset. This will essentially "cut" or break the habitat dataset into your grid. 3) Run a dissolve on this intersected layer using the DISSOLVE field. You will see a "statistics" section in the dissolve tool. Add the field which contains the habitat name to this and choose "COUNT" as the statistic type. 4) Run the dissolve, and if I am correct you will have a dataset that has been dissolved by the name of the grid and have a count of the habitats in that grid.
I hope that makes sense (and works for you). It is where I would start, if it doesnt work I am sorry for wasting your time. I am sure it will.
You definitely want to use the Intersect tool for this rather than Spatial Join. There's no need to split your habitat shapefile into 18 pieces. Just input the (unsplit) habitat shapefile and your assessment polygons into Intersect.
As for getting your statistics, Dissolve will work as outlined in the previous post. But you can also use the Summary Statistics tool to create a table of habitat by assessment units.
I have a similar problem. I want to take advantage of the spatial join function because I want a count of polygons that are contained by target polygons, and I also want to summarize numerical attributes of the contained polygons for each target polygon.
However, Spatial Join only provides an intersect option, not a containment option, which means I get counts and sums of polygons adjacent to as well as inside the target layer--not what I want.
Any suggestions? I can summarize fields, but that just results in a standalone output table; I want to be able to symbolize my results. If only Spatial Join had more spatial relationships to choose from....
(Sorry for hijacking--did you get a suitable solution?)
Got it--thanks to Chris Fox at Esri. Use the Spatial Join geoprocessing tool, make the smaller polygons the Join Features, the encompassing polygons the target, choose One-to-One (so you only have one row per target feature). For Match Option, choose CONTAINS. You will get a count field in your output feature class. And if you want statistics on any join attributes, for instance if you want to see a sum of an attribute for all join polygons contained by a target polygon, in the Field Map right-click the attribute and change the merge rule. Voila!