I have a map service with feature and raster layers. I'm trying to configure my popup so that it only displays results from the visible layers toggled on in the layer list. This works setting identifyParams.layerIds = analysisLayer.visibleLayers. However, I need an identifyParams tolerance of around 7 pixels for the features, and 1 pixel for the rasters. Only setting one tolerance gives me results from one or the other. Is it possible to set two difference tolerances in one popup? I've tried writing an if/else statement to define the different tolerances, but the popup disappeared from the map. Here is the code snippet:
<SPAN class="keyword token">function</SPAN> <SPAN class="token function">mapReady</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
map<SPAN class="punctuation token">.</SPAN><SPAN class="token function">on</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"click"</SPAN><SPAN class="punctuation token">,</SPAN> executeIdentifyTask<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">//create identify tasks and setup parameters</SPAN>
identifyTask <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">IdentifyTask</SPAN><SPAN class="punctuation token">(</SPAN>analysisURL<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
identifyParams <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">IdentifyParameters</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
identifyParams<SPAN class="punctuation token">.</SPAN>returnGeometry <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">//identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;</SPAN>
<SPAN class="comment token">//identifyParams.tolerance = 7;</SPAN>
<SPAN class="comment token">//identifyParams.layerIds = [1,2,4,5,6,8,9];</SPAN>
<SPAN class="comment token">//identifyParams.tolerance = 1;</SPAN>
<SPAN class="comment token">//identifyParams.layerIds = [12,13,14,17,18,19];</SPAN>
identifyParams<SPAN class="punctuation token">.</SPAN>width <SPAN class="operator token">=</SPAN> map<SPAN class="punctuation token">.</SPAN>width<SPAN class="punctuation token">;</SPAN>
identifyParams<SPAN class="punctuation token">.</SPAN>height <SPAN class="operator token">=</SPAN> map<SPAN class="punctuation token">.</SPAN>height<SPAN class="punctuation token">;</SPAN>
promises <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">function</SPAN> <SPAN class="token function">executeIdentifyTask</SPAN><SPAN class="punctuation token">(</SPAN>event<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
identifyParams<SPAN class="punctuation token">.</SPAN>geometry <SPAN class="operator token">=</SPAN> event<SPAN class="punctuation token">.</SPAN>mapPoint<SPAN class="punctuation token">;</SPAN>
identifyParams<SPAN class="punctuation token">.</SPAN>mapExtent <SPAN class="operator token">=</SPAN> map<SPAN class="punctuation token">.</SPAN>extent<SPAN class="punctuation token">;</SPAN>
identifyParams<SPAN class="punctuation token">.</SPAN>layerIds <SPAN class="operator token">=</SPAN> analysisLayer<SPAN class="punctuation token">.</SPAN>visibleLayers<SPAN class="punctuation token">;</SPAN>
promises<SPAN class="punctuation token">.</SPAN><SPAN class="token function">push</SPAN><SPAN class="punctuation token">(</SPAN>identifyTask<SPAN class="punctuation token">.</SPAN><SPAN class="token function">execute</SPAN><SPAN class="punctuation token">(</SPAN>identifyParams<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> iPromises <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">all</SPAN><SPAN class="punctuation token">(</SPAN>promises<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
iPromises<SPAN class="punctuation token">.</SPAN><SPAN class="token function">then</SPAN><SPAN class="punctuation token">(</SPAN>lang<SPAN class="punctuation token">.</SPAN><SPAN class="token function">hitch</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN> <SPAN class="punctuation token">(</SPAN>r<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> idResults <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN>
arrayUtils<SPAN class="punctuation token">.</SPAN><SPAN class="token function">map</SPAN><SPAN class="punctuation token">(</SPAN>r<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>response<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
arrayUtils<SPAN class="punctuation token">.</SPAN><SPAN class="token function">map</SPAN><SPAN class="punctuation token">(</SPAN>response<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>result<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> feature <SPAN class="operator token">=</SPAN> result<SPAN class="punctuation token">.</SPAN>feature<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> layerName <SPAN class="operator token">=</SPAN> result<SPAN class="punctuation token">.</SPAN>layerName<SPAN class="punctuation token">;</SPAN>
feature<SPAN class="punctuation token">.</SPAN>attributes<SPAN class="punctuation token">.</SPAN>layerName <SPAN class="operator token">=</SPAN> layerName<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> iTemplate<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></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><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>