Select to view content in your preferred language

Set extent of the highlighted features and expand the zoom

646
2
Jump to solution
05-01-2023 07:33 AM
BhavinSanghani
Occasional Contributor II

How to find the extent of the highlighted features on map?

In 3.x, there was a way to find extent of the highlighted (or selected by using FeatureLayer.selectFeatures()) features using graphicsUtils.graphicsExtent(selectedFeatures).

Is there a way to get the extent of the highlighted features in 4.x? Once I get an extent then I want to expand it based on user's settings. I can use goTo(selectedFeatures) but it doesn't seem to have any option to supply zoom factor to expand the extent. 

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

I'd run queryExtent method on the layerView using the same expression requirements. This will return an extent of all features meet the criteria. Or you can do something similar in this example: https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-find-the-extent-of-an-ar...

 

View solution in original post

2 Replies
UndralBatsukh
Esri Regular Contributor

Hi there, 

I'd run queryExtent method on the layerView using the same expression requirements. This will return an extent of all features meet the criteria. Or you can do something similar in this example: https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-find-the-extent-of-an-ar...

 

BhavinSanghani
Occasional Contributor II

Thanks @UndralBatsukh . queryExtent() has some limitations so I am avoiding it. But the url of the community post you shared looks good. I did not think of the callback of goTo() and expand it. I will try it and see how it goes, thanks for the help! 

0 Kudos