Select to view content in your preferred language

Zoom to extent of multiple geometries

380
1
02-16-2024 12:11 AM
DivyaArora
Emerging Contributor

I have added multiple geometries of different types - polygon and multipolygons on a graphic layer. Now i want to zoom to the extent of all the geometries. I am using below method  :

 
                setTimeout(function () {
                    self.mapView?.goTo(graphicsLayer.graphics.toArray());
                }, 2000);
 
But this zooms in the map to a very small view. Kindly suggest how can i set the zoom level to the extent of all the geometries.
0 Kudos
1 Reply
UndralBatsukh
Esri Regular Contributor

Hi there, 

You can just pass the graphicsLayer.graphics to MapView.goTo. This codepen shows it working: https://codepen.io/U_B_U/pen/gOEqzQO?editors=1000

 

0 Kudos