AnsweredAssumed Answered

Snapping doen't work in Measure tool

Question asked by Kirtika_Chauhan on Apr 24, 2014
Latest reply on Apr 29, 2014 by Kirtika_Chauhan
Hi,

I am trying to give my own feature layer in layerinfo of Measure tool. But it doesn't snap to points. I have point features in my map service, and I want to snap to features. Snapping works but it wouldn't snap to points rather it would snap to basemap.

Sample code:
esriConfig.defaults.geometryService = new GeometryService("MyGeometryServiceURL");

        map = new Map("map", {
            basemap: "topo",
            center: [-0.114, 51.8],
            zoom: 11
        });
        var dynlayer1 = new esri.layers.ArcGISDynamicMapServiceLayer("MyServiceURL");
        map.addLayer(dynlayer1);
        var sfs = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
         new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
         new Color([195, 176, 23]), 2), null);

        var parcelsLayer = new FeatureLayer("MyServiceURL", {
            mode: FeatureLayer.MODE_ONDEMAND,
            outFields: ["*"]
        });
        parcelsLayer.setRenderer(new SimpleRenderer(sfs));
        map.addLayers([parcelsLayer]);

        //dojo.keys.copyKey maps to CTRL on windows and Cmd on Mac., but has wrong code for Chrome on Mac
        var snapManager = map.enableSnapping({
        tolerance:0,
            snapKey: has("mac") ? keys.META : keys.CTRL
        });
        var layerInfos = [{ layer: parcelsLayer, snapToPoint: true}];
        snapManager.setLayerInfos(layerInfos);

        var measurement = new Measurement({
            map: map
        }, dom.byId("measurementDiv"));
        measurement.startup();

I am just wondering is there any limitation on snapping that it does only for grid's and not for point.

Any help would be really appreciated.

Outcomes