Select to view content in your preferred language

How do I set the zoom for a Polygon object?

521
1
11-17-2021 11:06 AM
rodsan724
Occasional Contributor

I'm using Map.SetViewpointGeometryAsync(myPolygon) and was wondering how to set the zoom of the polygon before using SetViewPointGeometryAsync?

0 Kudos
1 Reply
MatveiStefarov
Esri Contributor

Hello!  I'm not sure what you mean by setting "zoom of the polygon".

Would you like a Map to always open zoomed-in to a specific area, without having to call SetViewpointGeometryAsync?  Set the Map.InitialViewpoint property ahead of time.

Would you like to know at what scale a given geometry will fill the view? That is tricky to calculate, because the answer will depend on the location of the polygon, and size and shape of the MapView, and the Map's projection.  I cannot think of a better way to zoom to a geometry than SetViewPointGeometryAsync(geom) or SetViewpoint(new Viewpoint(geom)).

0 Kudos