AnsweredAssumed Answered

How to modify editing tools of feature layer in ArcGIS Portal

Question asked by Monica5 on Apr 30, 2018

When I tried to ope the map in mapviewer, it triggers error saying, the layer ****** cannot be added to the map. I want to change the features of feature layer of the map. Help me out. Thanks.

 

Here is my code:

 

var roadMaster = new FeatureLayer("http://***/server/rest/services/RoadsEdit/PMGSY_Edit/FeatureServer/0", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ['*']
});

map.addLayers([roadMaster]);

var imageParameters = new ImageParameters();
imageParameters.format = "gif";

var adminMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://***/server/rest/services/apris/Apris_Admin/MapServer", {

 

"imageParameters": imageParameters
});

var roadpmgsy = new ArcGISDynamicMapServiceLayer("http://***/server/rest/services/RoadsEdit/PMGSY_Edit/MapServer", {

 

"imageParameters": imageParameters
});
map.addLayers([adminMapServiceLayer,roadpmgsy]);

 

function initEditor(evt) {
var templateLayers = arrayUtils.map(evt.layers, function(result){
return result.layer;
});
var templatePicker = new TemplatePicker({
featureLayers: templateLayers,
grouping: true,
rows: "auto",
columns: 3
}, "templateDiv");
templatePicker.startup();

var layers = arrayUtils.map(evt.layers, function(result) {
return { featureLayer: result.layer };
});
var settings = {
map: map,
templatePicker: templatePicker,
layerInfos: layers,
toolbarVisible: true,
enableUndoRedo:true,
createOptions: {
polylineDrawTools:[ Editor.CREATE_TOOL_FREEHAND_POLYLINE ],
polygonDrawTools: [ Editor.CREATE_TOOL_FREEHAND_POLYGON,
Editor.CREATE_TOOL_CIRCLE,
Editor.CREATE_TOOL_TRIANGLE,
Editor.CREATE_TOOL_RECTANGLE,

]
},
toolbarOptions: {
reshapeVisible: true,
cutVisible:true,
mergeVisible:true


}
};

var params = { settings: settings };
var myEditor = new Editor(params, 'editorDiv');
//define snapping options
var symbol = new SimpleMarkerSymbol(
SimpleMarkerSymbol.STYLE_CIRCLE,
15,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([255, 0, 0, 0.5]),
5
),
null
);
map.enableSnapping({
snapPointSymbol: symbol,
tolerance: 20,
snapKey: keys.ALT
});

myEditor.startup();

Outcomes