Select to view content in your preferred language

Buffer query not working

697
0
05-12-2010 11:35 AM
MostafaAsadi
Emerging Contributor
Hi,

Can someone figure out why my buffer query is not working? There are basically 3 parts to it:
1. find the piece of land with buffer distance (in some sample codes this is called the hazardous parcel),
2. find buffer geometry,
3. find pieces of lands within the buffer geometry.

Part 3 is not working. The code below is the callback for part 1 (i.e. the QueryTask has found the hazardous parcel and is returning it in a featureSet).

callback: function(featureSet) {
// display the features inside the featureSet on the map
// ....
//

/* Buffer search */

var params = new esri.tasks.BufferParameters();
params.features = featureSet.features;
params.distances = ["500"];
params.unit = esri.tasks.BufferParameters.UNIT_FOOT;
//params.unionResults = true;
params.bufferSpatialReference = new esri.SpatialReference({
 wkid: this.configData.search.projectedSpatialRef
});

var geoServer = "http://pathToGeometryServe";
var gsvc = new esri.tasks.GeometryService(geoServer);

// Perform buffer search
gsvc.buffer(params, dojo.hitch(this, function(graphics) {
 // Add the buffer to the screen
 var symbol = new esri.symbol.SimpleFillSymbol("solid", new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_NULL), new dojo.Color([255, 255, 0, 0.5]));
 var gBuffer = new esri.Graphic(graphics[0].geometry, symbol);
 
 this.map.graphics.add(gBuffer);
 
 // Set up query for surrounding parcels
    var qSurroundingParcels = new esri.tasks.Query();
 var taskSurroundingParcels = new esri.tasks.QueryTask("http://mapServerUrl");
 
    qSurroundingParcels.outFields = ["field1", "field2", "field3"];
    qSurroundingParcels.returnGeometry = true;
    qSurroundingParcels.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;
 qSurroundingParcels.geometry = gBuffer.geometry;
  
 // Query for parcels within the buffer
 taskSurroundingParcels.execute(qSurroundingParcels, dojo.hitch(this, function(fset) {
  console.debug("taskSurroundingParcels completed");
 }));

 /* 2nd attemp at getting it to work but no luck */
 /*taskSurroundingParcels.execute(qSurroundingParcels);
 this.setMessage("FINDING...");
 
 dojo.connect(taskSurroundingParcels, "onComplete", function(fset) {
  this.setMessage("DONE.");
 });*/
}));


Basically I never see "taskSurroundingParcels completed" in Firebug.
0 Kudos
0 Replies