Error: Unable to complete operation

3876
7
03-27-2013 08:13 AM
AlexGolebiewski
New Contributor
I keep getting the following error in firebug


Error: Unable to complete operation.
.cache["esri/utils"]/</esri._request/req.load()?v=3.2 (line 34)
.cache["dojo/_base/xhr"]/</dojo._ioSetArgs/<()?v=3.2 (line 15)
_1c6()?v=3.2 (line 15)
_1c4()?v=3.2 (line 15)
()?v=3.2 (line 15)
_1c6()?v=3.2 (line 15)
_1c4()?v=3.2 (line 15)
()?v=3.2 (line 15)
.cache["dojo/_base/xhr"]/</_437()?v=3.2 (line 15)
.cache["dojo/_base/xhr"]/</_430/func()?v=3.2 (line 15)
.cache["dojo/_base/xhr"]/</_430()?v=3.2 (line 15)


...eateSegments:function(_764){_764.shape.path=_764.vmlPath;_764.segmented=false;_7...
0 Kudos
7 Replies
SubaKrishnan
Esri Contributor
Please provide more information on what you trying to do to encounter this error. I am guessing you are using Printing tools or Geometry service. This error usually comes up when you pass in the required parameters.
0 Kudos
AlexGolebiewski
New Contributor
I am just trying to display a map with counties and national parks. see code below.

dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.map");
dojo.require("dijit.layout.AccordionContainer");
dojo.require("dojo.fx");// needed if use jsapi 3.0 or 3.2
dojo.require("agsjs.dijit.TOC");
dojo.require("esri.utils");
dojo.require("esri.layers.FeatureLayer");
dojo.require("esri.tasks.geometry");
dojo.require("esri.dijit.Scalebar");
dojo.require("esri.graphic");

var countyLayer;
var parkLayer;
var trailsLayer;
var trailsFeatureLayer;
var parkBoundsLayer;
var map;
function init() {
esri.config.defaults.io.timeout = 300000;
//map = null;
map = new esri.Map("mapDiv", { extent: esri.geometry.geographicToWebMercator(new esri.geometry.Extent(-105.5,37.4,-97.1,42.8, new esri.SpatialReference({wkid:4326}))) });
var initBaseMap = new esri.layers.ArcGISTiledMapServiceLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/");
map.addLayer(initBaseMap);
var query = new esri.tasks.Query();
query.returnGeometry = true;
query.where = "(STATE = '08' AND COUNTY = '013') OR (STATE = '08' AND COUNTY = '069') OR (STATE = '08' AND COUNTY = '123') OR (STATE = '56' AND COUNTY = '001') OR (STATE = '56' AND COUNTY = '021')";
parkLayer = new esri.layers.ArcGISDynamicMapServiceLayer("https://insidemapservices.nps.gov/arcgis/rest/services/NPSUnits/MapServer", {
id: 'parkLayer',
opacity: 1.0
});
trailsLayer = new esri.layers.ArcGISDynamicMapServiceLayer("https://insidemapservices.nps.gov/arcgis/rest/services/NPSNationalTrails/MapServer", {
id: 'trailsLayer',
opacity: 1.0
});
var countiesSelectionSymbol = new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([82, 132, 250, 0.2]));
countiesSelectionSymbol.setOutline(new esri.symbol.SimpleLineSymbol("solid", new dojo.Color("blue"), 2));
countyLayer = new esri.layers.FeatureLayer("https://insidemapservices.nps.gov/arcgis/rest/services/USCounties2000/MapServer/0", {
outFields: ["*"],
mode: esri.layers.FeatureLayer.MODE_SELECTION
});
countyLayer.setSelectionSymbol(countiesSelectionSymbol);
map.addLayer(countyLayer);
parkBoundsLayer = new esri.layers.FeatureLayer("https://insidemapservices.nps.gov/arcgis/rest/services/NPSUnits/MapServer/0", {
outFields: ["*"],
mode: esri.layers.FeatureLayer.MODE_SELECTION
});
var parkBoundsSelectionSymbol = new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([250, 50, 2, 0.5]));
parkBoundsSelectionSymbol.setOutline(new esri.symbol.SimpleLineSymbol("solid", new dojo.Color("red"), 3));
parkBoundsLayer.setSelectionSymbol(parkBoundsSelectionSymbol);
map.addLayer(parkBoundsLayer);
trailsFeatureLayer = new esri.layers.FeatureLayer("https://insidemapservices.nps.gov/arcgis/rest/services/NPSNationalTrails/MapServer/0", {
outFields: ["*"],
mode: esri.layers.FeatureLayer.MODE_SELECTION
});
var trailsFeatureSelectionSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([102, 0, 204]), 3);
trailsFeatureLayer.setSelectionSymbol(trailsFeatureSelectionSymbol);
map.addLayer(trailsFeatureLayer);
countyLayer.queryFeatures(query, function (featureSet) {
selectCounties(query);
if (featureSet.features.length > 0 && featureSet.features[0].geometry.type === "polygon") {
dojo.forEach(featureSet.features, function (feature) {
selectParks(feature.geometry);
selectTrails(feature.geometry);
});
}
}, function () { });
dojo.connect(map, 'onLayersAddResult', function () {
var toc = new agsjs.dijit.TOC(
{
map: map,
layerInfos: [
{
layer: parkLayer,
title: "NPS Parks"
},
{
layer: trailsLayer,
title: "NPS - DOI Trails"
}
]
},
'tocDiv'
);
toc.startup();
});
map.addLayers([trailsLayer, parkLayer]);
}
dojo.ready(init);
function selectCounties(query) {
var deferred;
deferred = countyLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, function (features) {
//Zoom map to entire extent of counties
map.setExtent(esri.graphicsExtent(features).expand(2));
});
return deferred;
}
function selectParks(polygon) {
var query = new esri.tasks.Query();
query.geometry = polygon.getExtent();
query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;
parkBoundsLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_ADD, showParkNames(), function () { });
}
function showParkNames(features) {
dojo.forEach(features, function (feature) {
var featureText = features.attributes.UNIT_TYPE + ' - ' + feature.attributes.PARKNAME + ' (' + feature.attributes.UNIT_CODE + ') ';
dojo.create("li", { innerHTML: featureText }, dojo.byId("parks"));
});
}
function selectTrails(polygon) {
var query = new esri.tasks.Query();
query.geometry = polygon.getExtent();
query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;
trailsFeatureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_ADD, showTrailNames(), function () { });
}
function showTrailNames(features) {
dojo.forEach(features, function (feature) {
var featureText = feature.attributes.NationalTrailDesignation;
dojo.create("li", { innerHTML: featureText }, dojo.byId("parks"));
});
} 
0 Kudos
SamirGambhir
Occasional Contributor III
I have the same issue with my application. It was running fine all this while but this error message start appearing since last week. I have checked my code but cannot find any reason for this to happen. Interestingly, in my case the error message appears at the initial load. My dynamic combobox is not populated and some of my functions such as zoom etc. do not work. Refreshing the app takes care of these issues, but another refresh gives the same error message. So every alternate refresh gives the error message. Also, when this error message appears, my functions run only when I click the relevant button twice.

This is quite a general overview as it'll be hard to share my entire code to figure out where the problem lies. If too many people are facing this issue, then maybe ESRI should look into it from there end.

Thanks
Samir
0 Kudos
AlexGolebiewski
New Contributor
Can anyone help please?
0 Kudos
SamirGambhir
Occasional Contributor III
Can anyone help please?


I resolved my problem by focusing on my proxy page. It turned out that my proxy page was not working. I followed the instructions to set this up and I could see my proxy doing its job.
0 Kudos
AlexGolebiewski
New Contributor
I resolved my problem by focusing on my proxy page. It turned out that my proxy page was not working. I followed the instructions to set this up and I could see my proxy doing its job.


Do you have a link to a good walk through on how to set up the proxy by any chance?
0 Kudos
SamirGambhir
Occasional Contributor III
Do you have a link to a good walk through on how to set up the proxy by any chance?


I used the steps suggested by ESRI which can be accessed here: http://help.arcgis.com/en/webapi/javascript/arcgis/jshelp/ags_proxy.html. Make sure that you add the serverUrls in the proxy file as mentioned in this document. I hope this is helpful.
0 Kudos