multiple spatial joins with individual join field column merge rules drops fields of target feature

3474
4
Jump to solution
05-03-2015 01:51 PM
ChrisPedrezuela
Occasional Contributor III

hi guys,

as the subject says, i got say 2 fc, and i got 2 hazard data. i use iterator and iterate thru the fcs. for each iteration i spatial join hazard data that has integer values with the fc. i use a merge rule "max" to get the highest hazard value for the fc. once i set this up and run it. the second fc's fields are dropped and what it gets is just the join fields. is there a way to preserve original fields of input fcs when setting up merge rules for the join field?

0 Kudos
1 Solution

Accepted Solutions
SepheFox
Frequent Contributor

Hey Thanos, it's hard to know where things are going awry without seeing a screen shot of the model. By default though, the spatial join should retain all the fields from both the target and join features, so I'm guessing something is not right with the way you have your field mapping set up. The help file for Spatial Join has a great example script in it, where they are doing essentially the same thing, except getting the mean of a particular field. Of course this might be easier to set up in Python: ArcGIS Desktop . If this doesn't help you at all, maybe you could post a screen shot of both the model, and the Spatial Join tool dialog.

View solution in original post

4 Replies
SepheFox
Frequent Contributor

Hey Thanos, it's hard to know where things are going awry without seeing a screen shot of the model. By default though, the spatial join should retain all the fields from both the target and join features, so I'm guessing something is not right with the way you have your field mapping set up. The help file for Spatial Join has a great example script in it, where they are doing essentially the same thing, except getting the mean of a particular field. Of course this might be easier to set up in Python: ArcGIS Desktop . If this doesn't help you at all, maybe you could post a screen shot of both the model, and the Spatial Join tool dialog.

ChrisPedrezuela
Occasional Contributor III

I got the process sorted Sephe. I ditched the model and created a script which is based on the sample from the help files like you mentioned.

0 Kudos
SepheFox
Frequent Contributor

Oh great! Yeah, I think Python is a better way to go about it. Do you mind marking the question as answered? Thanks!

0 Kudos
curtvprice
MVP Esteemed Contributor

Model Builder has its place and is a very powerful environment especially for your own "once off" analyses.

I've found the only way to get good control over field maps in ModelBuilder is to write a python function that creates field maps and run it within a Calculate Value tool. It's hard to ask that much from ModelBuilder (field maps are indeed complicated) but it can be done.