Hello,
I have defined several remote points of interest on my 2D map and the scale is not appropriate.
Not wanting to put an arbitrary value in MainMapView.SetViewpointScaleAsync(value), is there a function to adapt the scale to display all the points present?
Or how is the scale calculated?
Thanks !
Sincerely
Solved! Go to Solution.
If your points are in a layer it's possible to set the ViewPoint to the Layer.FullExtent envelope
myMapView.SetViewpointAsync(new Viewpoint(YourLayerEnvelope));
Of course you have to obtain the YourLayerEnvelope
If you have your point of interest geometries, you could also use GeometryEngine.combineExtents to get the minimal containing envelope. You can then pass that envelope to MapView.SetViewpointGeometryAsync() (that's a shortcut/equivalent to the method that Keith mentioned above).
If your points are in a layer it's possible to set the ViewPoint to the Layer.FullExtent envelope
myMapView.SetViewpointAsync(new Viewpoint(YourLayerEnvelope));
Of course you have to obtain the YourLayerEnvelope
If you have your point of interest geometries, you could also use GeometryEngine.combineExtents to get the minimal containing envelope. You can then pass that envelope to MapView.SetViewpointGeometryAsync() (that's a shortcut/equivalent to the method that Keith mentioned above).
Hello,
I had tried this approach by creating the envelope myself but nothing worked because I had not specified the spatial reference frame...
Thanks for your solutions, they are cleaner than the one I used 🙂