isuede

Problem : buffer after identifyTask

Discussion created by isuede on Sep 25, 2012
Latest reply on Sep 26, 2012 by isuede
gs.buffer(params, function (geometries));

no any returns.

Visual Studio one-line by one-line run mode.

I see the some error code.

"catch(e){_1c8.deferred.reject(e);}}"


function Buffer() {

    strCurrentTool = "Buffer";

    Handle_onClick = dojo.connect(map, "onClick", function (evt) {

        map.graphics.clear();

        var node = $("#toc").dynatree("getTree").getNodeByKey(selectedLayerID);
        if (node == null) {
            return;
        }

        var identifyTask = new esri.tasks.IdentifyTask(basemapLayer.url);

        var identifyParams = new esri.tasks.IdentifyParameters();
        identifyParams.tolerance = 3;
        identifyParams.returnGeometry = true;
        identifyParams.layerIds = [selectedLayerID];
        identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
        identifyParams.width = map.width;
        identifyParams.height = map.height;

        identifyParams.geometry = evt.mapPoint;
        identifyParams.mapExtent = map.extent;

        identifyTask.execute(identifyParams, function (identifyResults) {

            var gs = esri.config.defaults.geometryService;
            var params = new esri.tasks.BufferParameters();
            params.geometries = [identifyResults[0].feature];

            params.distances = [100];
            params.unit = esri.tasks.GeometryService.UNIT_METER;
            params.outSpatialReference = map.spatialReference;

            gs.buffer(params, function (geometries) {

                var symbol = new esri.symbol.SimpleFillSymbol(
                    esri.symbol.SimpleFillSymbol.STYLE_SOLID,
                    new esri.symbol.SimpleLineSymbol(
                        esri.symbol.SimpleLineSymbol.STYLE_SOLID,
                        new dojo.Color([0, 0, 255, 0.65]), 2
                        ),
                    new dojo.Color([0, 0, 255, 0.35])
                );

                dojo.forEach(geometries, function (geometry) {
                    var graphic = new esri.Graphic(geometry, symbol);
                    map.graphics.add(graphic);
                });

            });
        });
    });
}

Outcomes