1

We are using ArcGis js API version 3.12 and 3.5. and we are trying to use the snappingManager object. We can only snap to recently drawn objects and can't snap to all the layers. We have just once been able to snap to the selected layers. Can anyone help us get snap to any selected layer?

Sample Code

var symbol = new esri.symbol.SimpleMarkerSymbol(
    esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 
    30, 
    new esri.symbol.SimpleLineSymbol(
        esri.symbol.SimpleLineSymbol.STYLE_SQUARE, 
        new dojo.Color([255, 0, 0, 1]), 
        1
        ),
        null 
    );
    _root.log('snap symbol is set');
    _root.map.snappingManager = _root.map._map.enableSnapping({
          map : _root.map._map,
          snapPointSymbol: symbol,
          tolerance: toleranceSnap,
          alwaysSnap : true
          });

    console.log(layerIds);
    var snapLayerInfo=new Array();
    for(var i=0;i<layerIds.length;i++){
                        snapLayerInfo.push(_root.map._map.getLayer(_root.profile._activeMapServiceId).layerInfos[layerIds[i]]);
                    }; 
    console.log(snapLayerInfo);
    var layerInfos = [
       {
       layer:_root.map._map.getLayer(_root.profile._activeMapServiceId).layerInfos,
           snapToEdge :edgeSnap,
           snapToPoint :pointSnap,
           snapToVertex :vertexSnap
        }];
    console.log(layerInfos);
    _root.map.snappingManager.setLayerInfos(layerInfos);    
  • This problem fixed.So – mehmetunluu May 28 '15 at 11:32
  • Hi, ı fixed this problem. I add esrifeaturelayer to map. Snappping manager looking featurelayer so before start edits used layer adding feature laye that only drawing layer is snap. Now which layers added feature layer to map that is snapped. Thanks. – mehmetunluu May 29 '15 at 6:23
-1

ı fixed this problem. I add esrifeaturelayer to map. Snappping manager looking featurelayer so before start edits used layer adding feature laye that only drawing layer is snap. Now which layers added feature layer to map that is snapped.

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.