Select to view content in your preferred language

Center and zoom for a list of geometries

290
1
12-15-2022 06:12 AM
ofirrosner
New Contributor III

I have a list of geometries 
I want to get the center of them of all those geometries and then do the "best" zoom(i.e the maximum zoom-in where all the geometries in my list will be visible)

To get the center of the all my geometries i think i can use
1.GeometryEngine.CombineExtents(List<geometry>)
2.GeoView.SetViewPointAsync(viewpoint)

But my main problem is that i don't know how to get the "best" zoom as desribed above
is there anyway i can achieve that

Thanks

0 Kudos
1 Reply
dotMorten_esri
Esri Notable Contributor

One of the constructors of the viewpoint takes a geometry, so just pass in the combined extent to its constructor, and it'll auto-calculate the best zoom to fit that extent.

0 Kudos