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

78
16
Jump to solution
09-19-2019 09:06 AM
Highlighted
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!

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
MVP Esteemed Contributor

Douglas,

   The buffer method returns a deferred. So just listen for buffer complete event.

View solution in original post

Reply
0 Kudos
16 Replies
Highlighted
MVP Esteemed Contributor

Douglas,

   You can switch to the by spatial and use a negative number in the buffer to do your selection by.

Reply
0 Kudos
Highlighted
Occasional Contributor

Thanks for the reply Robert.  However, I need to perform this intersection right after the parcel selection takes places and before the results are displayed.  So, are you saying I can apply a negative buffer and use that as the intersection with another layer?  I'll take a look at your Spatial tab code and see if I can call that before the results are displayed.  Do you have some thoughts or suggestions on how to accomplish this?

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

Douglas,

So, are you saying I can apply a negative buffer and use that as the intersection with another layer?

Correct.

You could change the spatial relationship in the eSearch queryTask code to be contains instead of intersects too.

Reply
0 Kudos
Highlighted
Occasional Contributor

Robert.

I'm having an issue when calling the _bufferGeometries function.  I need it to complete the geometryService buffer event before continuing through the rest of my code because I need the buffered graphic geometry.  How can I force the esriConfig.defaults.geometryService.buffer() event to complete before moving on through the rest of my function?

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

Douglas,

   The buffer method returns a deferred. So just listen for buffer complete event.

View solution in original post

Reply
0 Kudos
Highlighted
Occasional Contributor

Robert,

That did the trick.  Thanks!

Reply
0 Kudos
Highlighted
Occasional Contributor

Hi Robert,

Not sure if you're still following this thread but I thought I had things worked out, turned out I was wrong.  What I'm trying to do is within the _onSearchFinish function, instead of calling the _drawResults function, I'm calling a custom _doSpatialQuery function. Within this function I'm looping through the selection results (parcels) and it's here where I need get the buffer (negative distance) of each result and then use that buffer geometry as the input to perform the spatial query (intersection) with another layer to build some links within each result.  I've attached my modified eSearch widget for reference.  I've just been spinning my wheels with this so any help/input would be GREATLY appreciated!

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

Douglas,

Are you using a standard esri basemap or are you using a custom one that would put the maps WKID other than 102100 (webmercator)? 

Reply
0 Kudos
Highlighted
Occasional Contributor

I'm using a custom basemap where the data is in Nebraska State Plane NAD83 and the service is published in Web Mercator.  So, the map spatial reference WKID should be 102100.

Reply
0 Kudos