schlot

simplify polygon for input as queryTask geometry

Discussion created by schlot on Aug 7, 2013
I am using a findTask to search for a district by it's ID number.  I need the geometry of this polygon as the input to a queryTask.  I figured this would be simple, but I'm having trouble with the syntax on the geometryservice.simplify.

I have the reference to my geometryService defined and I have this code set up with proxy pages, in case the number of coordinates from the geometry was somehow the problem. 

This is the result handler function from my findTask:
function findDistResults(results) {
   var result = results[0];  //there should only be unique district numbers found in each layer  
   
  // var distExtent = districtGeometry.getExtent();
  var resultGeometry = result.feature.geometry;

geometryService.simplify([resultGeometry], function (simplifiedGeometries) {
districtGeometry = simplifiedGeometries[0];
});

    runQueries(districtGeometry);
}  


The first thing the function runQueries does is set districtGeometry as the geometry for my Query I've defined previously.   The querytask looks to failing because it doesn't like the geometry I'm using as input.  For grins, I captured the extent of my polygon instead and it uses that  just fine as the query geometry input.  I tried the polygon first without simplifying it and it didn't work, which is why I'm going through the extra step of trying to simplify it first. 

Hopefully this is a very basic syntax problem I'm just not seeing.  Putting a breakpoint within the function of the geometryService, it doesn't look like it every goes into it.

Outcomes