I want to replicate the behavior of Arcmap analysis tools/overlay/intersect tool by using SPATIAL_REL_INTERSECTS.
In that tool, when you specified two polygon classes, it doesn't matter the order, the area of intersection is the same.
I want the users to be able to use any two polygon classes to run the intersect tool to get the intersected area.
I am using the script below. If I switch the first layer with the second the results are different. Why? The intersected area should be the same regardless which layer is specified as first or second. Thanks.
<SPAN class="keyword token">var</SPAN> firstgraphics <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> features <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN>
array<SPAN class="punctuation token">.</SPAN><SPAN class="token function">forEach</SPAN><SPAN class="punctuation token">(</SPAN>firstlayer<SPAN class="punctuation token">.</SPAN>graphics<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN> <SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
firstgraphics<SPAN class="punctuation token">.</SPAN><SPAN class="token function">push</SPAN><SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">.</SPAN>geometry<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">var</SPAN> secondgraphics <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN>
array<SPAN class="punctuation token">.</SPAN><SPAN class="token function">forEach</SPAN><SPAN class="punctuation token">(</SPAN>secondlayer<SPAN class="punctuation token">.</SPAN>graphics<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN> <SPAN class="punctuation token">(</SPAN>feature1<SPAN class="punctuation token">)</SPAN> <SPAN