How to Zoom a Created Layout's Map Frame to the Last Active Map

275
2
Jump to solution
05-07-2024 02:45 AM
MaxW
by
Emerging Contributor

After creating a layout, using ElementFactory.Instance.CreateMapFrameElement(lyt, env, map) only displays the entire map view. However, I want to display the scale size that was last presented in the map. How can I achieve this?

0 Kudos
1 Solution

Accepted Solutions
CharlesMacleod
Esri Regular Contributor

To fix the scale of a map on a Layout u need to set a display constraint on the frame. See here https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Layouts#map-frame-display-constraints. Look at fixed scale and fixed center and scale.

View solution in original post

0 Kudos
2 Replies
CharlesMacleod
Esri Regular Contributor

To fix the scale of a map on a Layout u need to set a display constraint on the frame. See here https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Layouts#map-frame-display-constraints. Look at fixed scale and fixed center and scale.

0 Kudos
MaxW
by
Emerging Contributor

Thank you, but in the end, I used SetCamera to achieve my goal. I appreciate your suggestion nonetheless. Here's the code snippet:

Camera camera = map_frame.Camera;
camera.Scale = mapView.Camera.Scale;
camera.X = mapView.Camera.X;
camera.Y = mapView.Camera.Y;
map_frame.SetCamera(camera);

0 Kudos