AnsweredAssumed Answered

Buffer Geometry service return --> Get extent for further processing.

Question asked by mravichandran on Jul 22, 2013
Latest reply on Jul 24, 2013 by mravichandran
dear Readers,

thank you for taking the time to read this query. being the 1st js app, a lot of things are not very evident to me.

the app currently is able to do a geometry service buffer associated with a REST service and is able to display the yellow color (255,255,0,0.75) for the selected features.

i do not know whether i am going down the right path by doing a convex hull to get the extent. all i need is a minimum bounding rectangle of the bufffered selection to be sent to a geo processing service for additional work.

the code works even when it calls the convex hull function and i do see results (polygons on the firebug window) and nothing gets added.

if i do not have to do a convex hull, that is also fine.

further, all the time, i will be using a polygon layer to do the buffer and i need to use the results of the buffer for a MBR to a gp service.


geometryService.on("buffer-complete", function (result) {; //draw the buffer geometry on the map as a map graphic var symbol = new esri.symbol.SimpleFillSymbol( esri.symbol.SimpleFillSymbol.STYLE_NULL, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SHORTDASHDOTDOT, new dojo.Color([0, 0, 0]), 2), new dojo.Color([255, 255, 0, 0.75]) ); var bufferGeometry = result.geometries[0] var graphic = new esri.Graphic(bufferGeometry, symbol); var envelope = graphic.geometry.Extent;; //Select features within the buffered polygon. To do so we'll create a query to use the buffer graphic // as the selection geometry. var query = new esri.tasks.Query(); query.geometry = bufferGeometry; query.outFields = ["*"]; var geoms4ConvexHullOp; clulayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, function (results) { ??? geoms4ConvexHullOp =, function(eachfeatureresult) { return eachfeatureresult.geometry; } ); //var totalPopulation = sumPopulation(results); //var r = ""; //r = "<b>The total Census Block population within the buffer is <i>" + totalPopulation + "</i>.</b>"; //dojo.byId('messages').innerHTML = r; }); geometryService.convexHull(geoms4ConvexHullOp, function (hullresults) { //var symbol4Hull = new esri.symbol.FillSymbol( //esri.symbol.SimpleFillSymbol.STYLE_BACKWARD_DIAGONAL, //new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([128, 128, 128, 10])), //new dojo.Color([255, 255, 255, 0.75]) //); var symbol4Hull = new esri.symbol.SimpleFillSymbol(); var hullgraphics = new esri.Graphic(hullresults, symbol4Hull);; }, function (errors) { alert(errors); }); // });