How to get intersecting points of MapImageLayer features, selected by Rectangle?

1583
4
01-24-2021 05:17 AM
ChristianBischof
Esri Contributor

Hi folks,

I have a MapImageLayer which sublayer symbolizes roads of a country on a map. I want to sketch a rectangle over these Roads and get the intersection points (including the routes themselves) back.

So basically what I have is the MapImageLayer, which features I can also query but the only thing I get back are obviously all routes - I need to query it based on the "rectangle selection" which is currentyl sketched in a GraphicsLayer using the SketchViewModel.

 

Thanks in advance for your help!

0 Kudos
4 Replies
by Anonymous User
Not applicable

Have you looked at the geometry engines intersect method? Might be what you are looking for.

JohnGrayson
Esri Regular Contributor

Do you have a simple CodePen showing what you've tried so far?  The simplest approach is to use the queryFeatures() method on the Sublayer.  You might also consider converting the Extent to a Polyline to simplify the intersect operation.

UndralBatsukh
Esri Regular Contributor

Hi there, 

This simple test app show how to query features of a sublayer that intersect a rectangle. You'd have to modify it so that that you are querying all sublayers you need to query. Hope this helps.

JohnGrayson
Esri Regular Contributor

...and here's a slight modification to above codepen that shows how to only get features that intersect the extent boundary:

https://codepen.io/john-grayson/pen/GRNKPjw