var outputBuffer = new esri.layers.ArcGISDynamicMapServiceLayer("http://localhost:6080/arcgis/rest/services/buffer/MapServer",{ opacity: 0.75 }); map.addLayer(outputBuffer);
Solved! Go to Solution.
Thank you for your help pepatops!
I am not sure to understand well how it works. I tried like this without success:var bufferPoly = new esri.tasks.QueryTask("http://localhost:6080/arcgis/rest/services/buffer/MapServer"); var query = new esri.tasks.Query(); query.where = "1=1"; query.returnGeometry = true; bufferPoly.execute(query); bufferPoly.on("complete", function(result){ console.log(result) map.addLayer(result); });
I am using the query "1=1" just to test. It should returns all features. There is no error message in the server or console log but the buffers are not rendered on the map. Do I have to define the result layer styles?
var bufferPoly = new esri.tasks.QueryTask("http://localhost:6080/arcgis/rest/services/buffer/MapServer");
var bufferPoly = new esri.tasks.QueryTask("http://localhost:6080/arcgis/rest/services/buffer/MapServer/0");
var bufferPoly = new esri.tasks.QueryTask("http://localhost:6080/arcgis/rest/services/buffer/MapServer"); var query = new esri.tasks.Query(); query.where = "1=1"; query.returnGeometry = true; bufferPoly.execute(query); bufferPoly.on("complete", function(result){ console.log(result) map.addLayer(result); });
Thank you for your help pepatops!
I am not sure to understand well how it works. I tried like this without success:var bufferPoly = new esri.tasks.QueryTask("http://localhost:6080/arcgis/rest/services/buffer/MapServer"); var query = new esri.tasks.Query(); query.where = "1=1"; query.returnGeometry = true; bufferPoly.execute(query); bufferPoly.on("complete", function(result){ console.log(result) map.addLayer(result); });
I am using the query "1=1" just to test. It should returns all features. There is no error message in the server or console log but the buffers are not rendered on the map. Do I have to define the result layer styles?
var bufferPoly = new esri.tasks.QueryTask("http://localhost:6080/arcgis/rest/services/buffer/MapServer");
var bufferPoly = new esri.tasks.QueryTask("http://localhost:6080/arcgis/rest/services/buffer/MapServer/0");
You're own your way to go, but you should specify to the query task which layer must have be filtered, by using the layer index on the map service.
So, instead of:var bufferPoly = new esri.tasks.QueryTask("http://localhost:6080/arcgis/rest/services/buffer/MapServer");
You should have:var bufferPoly = new esri.tasks.QueryTask("http://localhost:6080/arcgis/rest/services/buffer/MapServer/0");
or 1, or 2, or whatever is the index of the layer being filtered.
Regards.
Roberto Pepato
Thank you, thats do it! I can filter the result by a field and map it. My last question is, is it possible to set the input features, for instance, apply the geoprocessing to a subset of selected features.
Or is it possible to change geoprocessing parameters (like the buffer distance) the same way, ie using QueryTask.