I have a line layer (faults) and a polygon layer (fishnet grid). The fishnet has a risk of earthquake attributed to each polygon. I want to take that risk value and give it to the fault lines which pass through that polygon. I am attempting to use the spatial join tool to do this.

I have the target layer as the fault lines and join layer as the risk polygons. I have selected the 'Within' operator and one-to-one join operation and set the risk values to be added as a field to the new layer with the merge rule set to sum (I want to add the risk of all the polygons that the line passes through).

The tool works for lines which are completely within a polygon and returns the risk value correctly but any lines which pass through 2 or more polygons are returned with a null value instead of the summed risk. If I uncheck the keep all target features then it leaves them out, implying that the tool doesn't think the lines are 'within' any polygons.

Is this an error in Arcmap? and how can I fix this? Or is that not how the 'within' operator works for lines within polygons? My assumption is that the 'Completely_within' operator should return what I am getting from the 'within' operator (also this is how it's described in the tool help).

Green yellow and red lines have had the risk values correctly attributed but as you can see its only the lines which fall completely within a polygon. The Purple liens are the ones which aren't being computed with the summed risk but are returned with null. The output

A screen cap of the tool before running (the warning is just the because the file name exists since i took it afterwards...)


1 Answer 1


Try using the "intersect" match option. Also, when you do that, you will need to go into the field-mapping section and set the proper aggregation methods for the relevant fields (do you want the values of the multiple polygons a line crosses to be averaged (mean), added, etc...).

Let us know if that doesn't work.

  • Yes! looks like that did the trick. I thought that would only apply to boundary intersection but I guess it applies to the 'area'. Do you have any comments on the logic that 'within' should do this?
    – DMusketeer
    Jan 9, 2014 at 16:05
  • 1
    I agree, based on the options provided, it does seem like 'within' should do this, but, I've always found that with GP Tools, if you set a bunch of custom options to make it run 'just how you want it to' and it doesn't work, go back and revert things back to the tool defaults and/or use broader/less restrictive options. In this case, intersect appears similar to within but is a bit broader in the helps explanation of it and is the default, so when experiencing problems like you were, I'd try that option first and then go from there to analyze why expected and actual results don't match.
    – John
    Jan 9, 2014 at 16:15
  • In this case, the match option "within" means that a feature has to be completely contained within another target feature. The purple lines are crossing boundaries, so they are not "within" a single polygon. "Intersect" is the correct match option here.
    – Mintx
    Jan 9, 2014 at 21:46
  • 1
    I think DMusketeer's confusion in the matter was probably from the odd fact that there is, for some reason, an option for "within" and "completely within", but per his example it is treating his use of "within" as requiring the feature to be completely within anyway. There are some little things like this where the ESRI documentation is unfortunately severely lacking in specificity and clarity or at least clarifying examples.
    – John
    Jan 10, 2014 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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