Greetings,
I'm trying to write a disjoint query to get an indication of which features are outside of the mapView's extent. I've structured the query but it appears that the spatial relationship "disjoint" produces the same results as using "intersect".
<SPAN class="keyword token">var</SPAN> deleteQuery <SPAN class="operator token">=</SPAN> fl<SPAN class="punctuation token">.</SPAN><SPAN class="token function">createQuery</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
deleteQuery<SPAN class="punctuation token">.</SPAN>geometry <SPAN class="operator token">=</SPAN> webMercatorUtils<SPAN class="punctuation token">.</SPAN><SPAN class="token function">webMercatorToGeographic</SPAN><SPAN class="punctuation token">(</SPAN>mapExtent<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
deleteQuery<SPAN class="punctuation token">.</SPAN>spatialRelationship <SPAN class="operator token">=</SPAN> <SPAN class="string token">"disjoint"</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// this is the default</SPAN>
deleteQuery<SPAN class="punctuation token">.</SPAN>returnGeometry <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">;</SPAN>
deleteQuery<SPAN class="punctuation token">.</SPAN>outFields <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN> <SPAN class="string token">"OBJECTID"</SPAN> <SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN>
fl<SPAN class="punctuation token">.</SPAN><SPAN class="token function">queryFeatures</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">then</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>disjointResults<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN>
fl<SPAN class="punctuation token">.</SPAN><SPAN class="token function">applyEdits</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>deleteFeatures<SPAN class="punctuation token">:</SPAN>disjointResults<SPAN class="punctuation token">.</SPAN>features<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="token function">then</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>delResults<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
fl<SPAN class="punctuation token">.</SPAN><SPAN class="token function">queryFeatureCount</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">then</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>count<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN>
console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'AFTER delete fl feature Count: '</SPAN> <SPAN class="operator token">+</SPAN> count<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN> Not sure what I am doing wrong. Does anyone see any glaring mistakes?
I logged my query to JSON and thought the '"where":"1=1"' part looked odd since I didn't specify a where property.
{"geometry":{"spatialReference":{"wkid":4326},"xmin":-78.78690645507774,"ymin":35.78811526137758,"xmax":-78.77317354491959,"ymax":35.79110471050848},"outFields":["OBJECTID"],"returnGeometry":false,"spatialRel":"disjoint","where":"1=1"}
Any ideas will be greatly appreciated.
Thanks, Tyler