var layernumber = 0 var stewardship = new FeatureLayer("http://tfsgis-iisd01:6080/arcgis/rest/services/Stewardship_SA3/FeatureServer/0", { mode: FeatureLayer.MODE_SELECTION, id: 'stewardship', outFields: ['*'] });
Solved! Go to Solution.
dojo.connect(dijit.byId("Activity"), 'onChange', function(value){ //alert('ok ' + event); activity = dijit.byId('Activity'); var layerId = activity.item["layerId"] console.log(layerId) activityGroupValue = dijit.byId('ActivityGroup').get('value') if (activityGroupValue == " " && value in oc(forestrylist)) { dijit.byId('ActivityGroup').set('value', "Forestry") } else if (activityGroupValue == " " && value in oc(medialist)) { dijit.byId('ActivityGroup').set('value', "Media") } else if (activityGroupValue == " " && value in oc(conservationeducationlist)) { dijit.byId('ActivityGroup').set('value', "Conservation Education") } else if (activityGroupValue == " " && value in oc(firelist)) { dijit.byId('ActivityGroup').set('value', "Fire") } else if (activityGroupValue == " " && value in oc(urbanforestrylist)) { dijit.byId('ActivityGroup').set('value', "Urban Forestry") } else if (activityGroupValue == " " && value in oc(professionaldevelopmentlist)) { dijit.byId('ActivityGroup').set('value', "Professional Development") } else if (activityGroupValue == " " && value in oc(oakwiltlist)) { dijit.byId('ActivityGroup').set('value', "Oak Wilt") } else if (value == "Forest Stewardship Plan") { x = 0 } }); var stewardship = new FeatureLayer("http://tfsgis-iisd01:6080/arcgis/rest/services/FeatureServiceStewAAreaAPoint/FeatureServer/" + layerId, { mode: FeatureLayer.MODE_SELECTION, id: 'stewardship_' + layerId, outFields: ['*'] }); map.addLayers([stewardship]);
var stewardship = new FeatureLayer("http://tfsgis-iisd01:6080/arcgis/rest/services/FeatureServiceStewAAreaAPoint/FeatureServer/0" , { mode: FeatureLayer.MODE_SELECTION, outFields: ['*'] }); map.addLayers([stewardship]); dojo.connect(dijit.byId("Activity"), 'onChange', function(value){ //alert('ok ' + event); activity = dijit.byId('Activity'); var layerId = activity.item["layerId"] console.log(layerId) activityGroupValue = dijit.byId('ActivityGroup').get('value') if (activityGroupValue == " " && value in oc(forestrylist)) { dijit.byId('ActivityGroup').set('value', "Forestry") } else if (activityGroupValue == " " && value in oc(medialist)) { dijit.byId('ActivityGroup').set('value', "Media") } else if (activityGroupValue == " " && value in oc(conservationeducationlist)) { dijit.byId('ActivityGroup').set('value', "Conservation Education") } else if (activityGroupValue == " " && value in oc(firelist)) { dijit.byId('ActivityGroup').set('value', "Fire") } else if (activityGroupValue == " " && value in oc(urbanforestrylist)) { dijit.byId('ActivityGroup').set('value', "Urban Forestry") } else if (activityGroupValue == " " && value in oc(professionaldevelopmentlist)) { dijit.byId('ActivityGroup').set('value', "Professional Development") } else if (activityGroupValue == " " && value in oc(oakwiltlist)) { dijit.byId('ActivityGroup').set('value', "Oak Wilt") } stewardship = new FeatureLayer("http://tfsgis-iisd01:6080/arcgis/rest/services/FeatureServiceStewAAreaAPoint/FeatureServer/" + layerId, { mode: FeatureLayer.MODE_SELECTION, id: 'stewardship_' + layerId, outFields: ['*'] }); map.addLayers([stewardship]); console.log(stewardship)
var loadedFeatLayers = {}; dojo.connect(dijit.byId("Activity"), 'onChange', function(value){ activity = dijit.byId('Activity'); var layerId = activity.item["layerId"]; // item["layerId"] may be an array; if so, use item["layerId"][0] var layer = loadedFeatLayers[layerId]; // if the feature layer not created, create it. if (!layer) { loadedFeatLayers[layerId] = new FeatureLayer("http://tfsgis-iisd01:6080/arcgis/rest/services/FeatureServiceStewAAreaAPoint/FeatureServer/" + layerId, { mode: FeatureLayer.MODE_SELECTION, id: 'stewardship_' + layerId, outFields: ['*'] }); map.addLayer(loadedFeatLayers[layerId]); } // if loaded, make it visible if not visible else { if (!layer.visible) layer.setVisibility(true); } });
var loadedFeatLayers = {}; dojo.connect(dijit.byId("Activity"), 'onChange', function(value){ //alert('ok ' + event); //remove the existing stewardship layer activity = dijit.byId('Activity'); var layerId = activity.item["layerId"]; // item["layerId"] may be an array; if so, use item["layerId"][0] var layer = loadedFeatLayers[layerId]; if (!layer) { loadedFeatLayers[layerId] = new FeatureLayer("http://tfsgis-iisd01:6080/arcgis/rest/services/FeatureServiceStewAAreaAPoint/FeatureServer/" + layerId, { mode: FeatureLayer.MODE_SELECTION, id: 'stewardship_' + layerId, outFields: ['*'] }); alert("TEST1") map.addLayer(loadedFeatLayers[layerId]); console.log(loadedFeatLayers[layerId]) } // if loaded, make it visible if not visible else { alert("TEST2") if (!layer.visible) { layer.setVisibility(true); } }
map.on("layers-add-result", initEditor); 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) { var settings = { map: map, templatePicker: templatePicker, layerInfos: layers, toolbarVisible: 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, mergeVisible: true, cutVisible: true } }; var params = {settings: settings}; var myEditor = new Editor(params,'editorDiv'); //define snapping options var symbol = new SimpleMarkerSymbol( SimpleMarkerSymbol.STYLE_CROSS, 15, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0, 0.5]), 5 ), null ); map.enableSnapping({ snapPointSymbol: symbol, tolerance: 20, snapKey: keys.ALT });