Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the below sample and i want to change the queried results from points to polygons

Probably very simple but cant get my head around where to change it.

I tried replacing the queryTask to and changing the symbol style to reflect this but it didnt seem to make much difference. I'm sure that somewhere and i cant see where, i need to make reference to the fact that we are now querying polygon and not point data.

share|improve this question
The 1st link doesn't work – Hairy Aug 1 '11 at 13:20
Do you have the proxy page set up correctly? I've had problems in the past when I overlooked that piece. – mrohlf Aug 1 '11 at 19:14
up vote 1 down vote accepted

The buffer user-defined graphics sample shows how to buffer points, line and polygons.

A graphic is added to the map for the user-defined geometry and then that geometry is sent to a geometry service be buffered:

function doBuffer(geometry) {
  switch (geometry.type) {
     case "point":
       var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 1), new dojo.Color([0,255,0,0.25]));
     case "polyline":
       var symbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255,0,0]), 1);
     case "polygon":
       var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NONE, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25]));

  var graphic = new esri.Graphic(geometry, symbol);;

  //setup the buffer parameters
  var params = new esri.tasks.BufferParameters();

  params.distances = [ dojo.byId("distance").value ];
  params.bufferSpatialReference = new esri.SpatialReference({wkid: dojo.byId("bufferSpatialReference").value});
  params.outSpatialReference = map.spatialReference;
  params.unit = eval("esri.tasks.GeometryService."+dojo.byId("unit").value);

  if (geometry.type === "polygon") {
    //if geometry is a polygon then simplify polygon.  This will make the user drawn polygon topologically correct.
    gsvc.simplify([geometry], function(geometries) {
      params.geometries = geometries;
      gsvc.buffer(params, showBuffer);
  } else {
    params.geometries = [geometry];
    gsvc.buffer(params, showBuffer);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.