Spatial Join - same results despite different Merge Rules and Match Options

757
3
12-21-2017 07:17 AM
DataOfficer
Occasional Contributor III

I have a shapefile with 414508 polygons representing different habitat types. I want to match the values from a 25m x 25m raster file for the same study area to these polygons, using the mean value of all 25m cells that fall within each polygon. 

I converted my raster file to points and ran the 'Spatial Join' tool with the polygon file as my Target Features and the new point file as Join Features. At first, I only changed the Merge Rule from 'First' to 'Mean' and left the default Match Option (Intersect). This did not give me the output I was after though as the matched values seemed too high, i.e. they didn't seem to reflect the 'mean' of all the values in within the polygon. 


I then experimented with the Match Option, choosing 'Contains' as well as 'Completely contains' but got the same results each time. During each try, the same point value was used for matching, and it doesn't seem like any merge rule was applied at all from looking at the attribute table (see below). The point whose value was matched to the polygon in the image below in no way represents the mean as the majority of points that fall within it have values <0.2, and only a very small portion of it is covered with points >0.2

What did I do wrong? How come the attribute table shows the value of a single point ('pointid' and 'gridcode') rather than the result of the 'mean' merge rule? Is there perhaps another way of achieving what I want without using the Spatial Join tool? I am using Pro 2.0 but also have Desktop 10.5 installed.

0 Kudos
3 Replies
DanPatterson_Retired
MVP Emeritus

what is the field name and content of the point file once you converted raster to points? It is that field that is used by the mapping rule

http://pro.arcgis.com/en/pro-app/help/analysis/geoprocessing/basics/field-map.htm

I can't make it out from your figure.  Perhaps a few examples of points that fall within a polygon (a simple select by location should isolate a few for testing)

0 Kudos
DataOfficer
Occasional Contributor III

Thanks, this has helped me work out what the issue was - I wasn't aware that the 'Merge Rule' needs to be set for each Output Field separately, so when I chose 'Mean' all I did was to apply a 'Mean' merge rule to the very first Output Field. I ran the tool again, setting the rule for the 'gridcode' field which holds my raster values, and it worked.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Glad it worked out...

0 Kudos