1

Can you please take a look at This Demo and let me know why I am not able to set up and enable Snapping on top of following feature Service? What I need is snapping to all features in mouse hover/over of each?

var map;
require(["esri/map",
  "esri/SnappingManager",
  "esri/layers/FeatureLayer",
  "dojo/keys",
  "dojo/domReady!"
], function(Map, SnappingManager, FeatureLayer, keys) {
  map = new Map("map", {
    basemap: "topo",
    center: [-88.158805, 41.786075],
    zoom: 18
  });

  var propertyLayer = new FeatureLayer("https://sampleserver6.arcgisonline.com/arcgis/rest/services/CommunityAddressing/FeatureServer/0", {
    mode: FeatureLayer.MODE_ONDEMAND,
    outFields: ["*"]
  });
  map.addLayers([propertyLayer]);

  var snapManager = map.enableSnapping({
    snapKey: keys.CTRL
  });
  var layerInfos = [{
    layer: propertyLayer,
    snapToVertex: true
  }];
  snapManager.setLayerInfos(layerInfos);

});
1

To enable the Snapping, you must be in some "drawing" mode. As you did it in your other demo

$("#add").on("click", function() {
  var toolbar = new esri.toolbars.Draw(map);
  toolbar.activate(esri.toolbars.Draw.POINT);
});

If not, you do not need to snap anything, because you will not draw anything =)

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.