mravichandran

HOW to: Query task with polygon graphic created.

Discussion created by mravichandran on Jul 2, 2013
Latest reply on Jul 7, 2013 by vinaybansal
dear Readers,

thank you reading this question of mine. Using http://developers.arcgis.com/en/javascript/samples/graphics_undoredo/ (without undo and redo), we had created the application and integrating the 2nd link: https://developers.arcgis.com/en/javascript/jssamples/query_buffer.html, we were able to do a map click as explained in the 2nd link to query our layer exposed by webservice.

Questions:
1.  instead of sending a evt.MapPoint as indicated in the query buffer lnk with a predetermined buffer, how to send a polygon or a polyline intersect - we want the result as it comes out from query buffer.

2.  another question i had was: in that query_buffer example, example run as-is, returns only Object id for our server - even though i had set query out params = ["*"] and verified that rest service /0 layer queried had all columns exposed in a queriable fashion.

I have 1 idea, i can disable the map-click function in the query buffer and try to use the graphics point button to do the selection.  but i am not still sure about how to set up the query task to ensure that it does not fail.

when i try to send the polyon geometry in the query buffer code, it does not return anything.

wanted to see whether there are any examples that i can use to move forward.

 function addToMap(geometry) {
        var symbol;
        toolbar.deactivate();
        
        //   map.showZoomSlider();
        switch (geometry.type) {
            case "point":
                symbol = new esri.symbol.SimpleMarkerSymbol();
                break;
            case "multipoint":
                symbol = new esri.symbol.SimpleMarkerSymbol();
                break;
            case "polyline":
                symbol = new esri.symbol.SimpleLineSymbol();
                break;
            default:
                symbol = new esri.symbol.SimpleFillSymbol();
                break;
        }
        var graphic = new esri.Graphic(geometry, symbol);
        graphicsDrawnOnScreen = graphic;
        
        map.graphics.add(graphic);
        var params = new esri.tasks.BufferParameters();
        //params.distances = [100];
        params.geometries = graphicsDrawnOnScreen;
      //  params.unit = esri.tasks.GeometryService.UNIT_METER;
        //params.geometries = [evt.mapPoint];     
        //params.unit = esri.tasks.GeometryService.UNIT_STATUTE_MILE;
        geometryService.buffer(params);
        geometryService.intersect(graphicsDrawnOnScreen);
        toolbarItemClicked == false;      
    }
i tried the above code without commenting out the above lines.

Outcomes