<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Snapping to multiple feature layers using esri js api 3.40 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/snapping-to-multiple-feature-layers-using-esri-js/m-p/1192401#M77922</link>
    <description>&lt;P&gt;Hi, I am working on utility network and allowing user to draw utility network in a web browser, the utility network is waterline, sewerline, valve, junction, bulkflow meter etc.,&lt;/P&gt;&lt;P&gt;For choosing the utility netwok I have a drop down, as user chooses the preferable network, &lt;STRONG&gt;I have to control, for which he has to snap&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var waterlineFeatureLayer = new FeatureLayer("http://MapServer/15",
{ mode: FeatureLayer.MODE_ONDEMAND,outFields: ["*"]});
var ValveMapServiceLayer = new FeatureLayer("http://MapServer/16",
{ mode: FeatureLayer.MODE_ONDEMAND,outFields: ["*"]});
var BulkfmMapServiceLayer = new FeatureLayer("http://MapServer/17",
{ mode: FeatureLayer.MODE_ONDEMAND,outFields: ["*"]});

snapManager = map.enableSnapping({
alwaysSnap: true,
});

if (selectedValue == 'valve' || selectedValue == 'bfm' || selectedValue == 'junction') {
// this is hapening perfectly
var layerInfos = [{
layer: waterlineFeatureLayer
}];
snapManager.setLayerInfos(layerInfos);
} else if (selectedValue == 'waterline') {
// i have to allow user to snap to both valve and bulkflow meter
// not any other feature layer for example junction, manhole etc.,
var layerInfos2 = [{
layer: ValveMapServiceLayer,
}];
snapManager.setLayerInfos(layerInfos2); 
var layerInfos3 = [{
layer: BulkfmMapServiceLaye
}];
snapManager.setLayerInfos(layerInfos3);
} else {
return;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried with creating one more snapping manager but not worked&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;snapManager2 = map.enableSnapping({
alwaysSnap: true,});
var layerInfos3 = [{
layer: BulkfmMapServiceLayer
}];
snapManager2.setLayerInfos(layerInfos3);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to pass the data like this, but did not worked&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var layerInfos2 = [{
layer: {ValveMapServiceLayer, BulkfmMapServiceLayer}
}];
snapManager.setLayerInfos(layerInfos2); &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I tried to pass the data like this also but did not worked&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;snapManager.setLayerInfos(layerInfos3, layerInfos2);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;There is no code for this kind in blog or stackoverflow.. please help&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jul 2022 02:45:43 GMT</pubDate>
    <dc:creator>JayakumarPD</dc:creator>
    <dc:date>2022-07-15T02:45:43Z</dc:date>
    <item>
      <title>Snapping to multiple feature layers using esri js api 3.40</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/snapping-to-multiple-feature-layers-using-esri-js/m-p/1192401#M77922</link>
      <description>&lt;P&gt;Hi, I am working on utility network and allowing user to draw utility network in a web browser, the utility network is waterline, sewerline, valve, junction, bulkflow meter etc.,&lt;/P&gt;&lt;P&gt;For choosing the utility netwok I have a drop down, as user chooses the preferable network, &lt;STRONG&gt;I have to control, for which he has to snap&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var waterlineFeatureLayer = new FeatureLayer("http://MapServer/15",
{ mode: FeatureLayer.MODE_ONDEMAND,outFields: ["*"]});
var ValveMapServiceLayer = new FeatureLayer("http://MapServer/16",
{ mode: FeatureLayer.MODE_ONDEMAND,outFields: ["*"]});
var BulkfmMapServiceLayer = new FeatureLayer("http://MapServer/17",
{ mode: FeatureLayer.MODE_ONDEMAND,outFields: ["*"]});

snapManager = map.enableSnapping({
alwaysSnap: true,
});

if (selectedValue == 'valve' || selectedValue == 'bfm' || selectedValue == 'junction') {
// this is hapening perfectly
var layerInfos = [{
layer: waterlineFeatureLayer
}];
snapManager.setLayerInfos(layerInfos);
} else if (selectedValue == 'waterline') {
// i have to allow user to snap to both valve and bulkflow meter
// not any other feature layer for example junction, manhole etc.,
var layerInfos2 = [{
layer: ValveMapServiceLayer,
}];
snapManager.setLayerInfos(layerInfos2); 
var layerInfos3 = [{
layer: BulkfmMapServiceLaye
}];
snapManager.setLayerInfos(layerInfos3);
} else {
return;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried with creating one more snapping manager but not worked&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;snapManager2 = map.enableSnapping({
alwaysSnap: true,});
var layerInfos3 = [{
layer: BulkfmMapServiceLayer
}];
snapManager2.setLayerInfos(layerInfos3);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to pass the data like this, but did not worked&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var layerInfos2 = [{
layer: {ValveMapServiceLayer, BulkfmMapServiceLayer}
}];
snapManager.setLayerInfos(layerInfos2); &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I tried to pass the data like this also but did not worked&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;snapManager.setLayerInfos(layerInfos3, layerInfos2);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;There is no code for this kind in blog or stackoverflow.. please help&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 02:45:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/snapping-to-multiple-feature-layers-using-esri-js/m-p/1192401#M77922</guid>
      <dc:creator>JayakumarPD</dc:creator>
      <dc:date>2022-07-15T02:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Snapping to multiple feature layers using esri js api 3.40</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/snapping-to-multiple-feature-layers-using-esri-js/m-p/1192412#M77923</link>
      <description>&lt;P&gt;it has to be passed like this... it is a&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;array of layerInfo objects&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (selectedValue == '2') {
var layerInfos2 = [
{
layer: ValveMapServiceLayer
},
{
layer: BulkfmMapServiceLayer
}
];
snapManager.setLayerInfos(layerInfos2);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 05:38:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/snapping-to-multiple-feature-layers-using-esri-js/m-p/1192412#M77923</guid>
      <dc:creator>JayakumarPD</dc:creator>
      <dc:date>2022-07-15T05:38:05Z</dc:date>
    </item>
  </channel>
</rss>

