How to get and set map scale?

2108
3
Jump to solution
07-22-2020 03:33 AM
BarbaraSchneider2
Occasional Contributor II

On the following page ProConcepts Map Authoring · Esri/arcgis-pro-sdk Wiki · GitHub is stated that the Map object has a map scale property, but I cannot find this property. MapView.Active doesn't have a map scale property neither.

So how can I get and set the map scale?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
BarbaraSchneider2
Occasional Contributor II

Hello Matthew,

thank you for your reply! For the map view, setting the map scale works as follows:

MapView mapView = MapView.Active;
Camera camera = mapView.Camera;
camera.Scale = 5000;
mapView.ZoomToAsync(camera, TimeSpan.Zero);  

Barbara

View solution in original post

3 Replies
MatthewDriscoll
MVP Alum
Camera camera = newMapframe.Camera;
camera.X = -118.465;
camera.Y = 33.988;
camera.Scale = 30000;
newMapframe.SetCamera(camera);‍‍‍‍‍‍‍‍‍‍

Use the camera of the map frame.  xy to center it, then scale it how you want.   I should note this is for layouts.  I don't know off the top of my head how it is done in the map view.  Let me know if that is what you need and I can try and figure it out.  

BarbaraSchneider2
Occasional Contributor II

Hello Matthew,

thank you for your reply! For the map view, setting the map scale works as follows:

MapView mapView = MapView.Active;
Camera camera = mapView.Camera;
camera.Scale = 5000;
mapView.ZoomToAsync(camera, TimeSpan.Zero);  

Barbara

Amadeus111
Occasional Contributor II

This is exactly what I am looking for, kudos to @BarbaraSchneider2 

0 Kudos