How to change (shrink) a polygon used to intersect another layer in the eSearch widget?

1326
16
Jump to solution
09-19-2019 09:06 AM
DouglasGuess
Occasional Contributor

I'm using Robert's eSearch widget and I'm trying to use a selected polygon to intersect another layer; however, I need to "shrink" the original polygon so the new polygon used to perform the intersection is fully contained within the original selected polygon.  I've tried to take the original selected polygon rings and subtract a value of 50 from each x,y pair, however, that just resulted in shifting the temp polygon and not actually "shrinking" it.  Any suggestions or help would be greatly appreciated!

0 Kudos
16 Replies
DouglasGuess
Occasional Contributor

I think I might have a resolution but I need to pass each original search results data (qResult data) into each of the selection buffered polygons.  Once I have that, I should be able to loop through each buffered poly and intersection that with my quarter quarter section layer to build the link url.  Any thoughts on how to pass the qResults into the buffered poly?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Douglas,

   The buffer results will always return in the same order that they are submitted. So you just replace the original graphics (which has the attributes data) geometry with the resultant buffer geometry.

0 Kudos
DouglasGuess
Occasional Contributor

So, something like this...

this.buffArray = buffGeometries;
for (b = 0; b < this.buffArray.length; b++){
    for (q = 0; q < this.qResults.length; q++){
         this.qResults.geometry.rings = this.buffArray.rings;
    }
}

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Yes but no need to go to the ring level.

this.qResults.geometry = buffGeometries;

0 Kudos
DouglasGuess
Occasional Contributor

Ok, that makes sense.  If there are multiple selected results, the buffer geometries returns only the first item.  I thought the ".then" of the geometryService.buffer acts like a promise and should wait until all geometries are returned.  How can I send both buffered results to the _doSpatialQuery function?

var unit = "UNIT_FOOT";
var dist = [parseFloat(-15)];
var bufferParameters = new BufferParameters();
var resultEvent;
var geoms = array.map(this.currentLayerAdded.graphics, function (gra) {    //**  2 Results
return gra.geometry;
});

bufferParameters.geometries = geoms;
bufferParameters.bufferSpatialReference = this.map.spatialReference;
bufferParameters.unit = GeometryService[unit];
bufferParameters.distances = dist;
bufferParameters.unionResults = true;
bufferParameters.geodesic = true;
bufferParameters.outSpatialReference = this.map.spatialReference;

esriConfig.defaults.geometryService.buffer(bufferParameters)
.then(lang.hitch(this, this._doSpatialQuery));

_doSpatialQuery: function(buffGeometries){       //** only 1 result in buffGeometries
   // Replace original selected poly geometry with buffered geometry
   for (b = 0; b < buffGeometries.length; b++){
      for (q = 0; q < this.queryResultsArray.length; q++){
         this.queryResultsArray.geometry = buffGeometries;
      }
   }

continue with function......

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Douglas,

  Because you have the buffer set to unionResults you will only get on geometry back a union of the two parcels buffered.

0 Kudos
DouglasGuess
Occasional Contributor

Ahhhh....  Thanks Robert.  Sometimes an extra set of eyes always helps.

Thanks again for ALL your help!!!