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

714
2
Jump to solution
07-22-2013 12:09 PM
Ravichandran_M_Kaushika
Occasional Contributor
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.

regards
ravi.


geometryService.on("buffer-complete", function (result) { map.graphics.clear(); //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; map.graphics.add(graphic); //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 = dojo.map(results, 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); map.graphics.add(hullgraphics); }, function (errors) { alert(errors); }); //http://forums.arcgis.com/threads/88350-Creating-a-minimum-bounding-polygon-around-different-geometry-types });  
0 Kudos
1 Solution

Accepted Solutions
JohnGravois
Frequent Contributor
since making a call to buffer returns a polygon geometry object to you, you can use the method getExtent() to find the extent of each individual polygon.

if instead you needed to determine the extent of a collection of graphics, you could use esri.graphicsExtent() and pass in the graphics themselves as the sol

View solution in original post

0 Kudos
2 Replies
JohnGravois
Frequent Contributor
since making a call to buffer returns a polygon geometry object to you, you can use the method getExtent() to find the extent of each individual polygon.

if instead you needed to determine the extent of a collection of graphics, you could use esri.graphicsExtent() and pass in the graphics themselves as the sol
0 Kudos
Ravichandran_M_Kaushika
Occasional Contributor
John,

good morning. Thank you for the reply.  that helped me.
0 Kudos