Get current scale of map

668
4
Jump to solution
02-17-2023 04:11 AM
MattiasWesterberg
New Contributor III

hi,

I set the scale of my map like this:

this.MyMapView.Map.MinScale = 2500000;

But how do i get the current scale of my map after i have zoomed to another scale?

Thanks in advance.

0 Kudos
3 Solutions

Accepted Solutions
VolkerMatzken
New Contributor III

Hello,

I think you want to try:

double scale = this.MyMapView.MapScale;

To set the scale, I would use:

await this.MyMapView.SetViewpointScaleAsync(scale);


Best regards,

Volker

View solution in original post

PreetiMaske
Esri Contributor

To get current scale of the map use `GeoView.GetCurrentViewpoint` and with ViewpointType as `CenterAndScale` 
https://developers.arcgis.com/net/api-reference/api/netwin/wpf/Esri.ArcGISRuntime.UI.Controls.GeoVie...

View solution in original post

dotMorten_esri
Esri Notable Contributor

I'm not quite following the relationship between mapview scale and ZIndex on features on your features and graphics, but having said that, you can only control the ZIndex within a single graphics overlay, and graphics always goes on top of feature layers, so there's no way to have a feature in-between two graphics.

View solution in original post

4 Replies
VolkerMatzken
New Contributor III

Hello,

I think you want to try:

double scale = this.MyMapView.MapScale;

To set the scale, I would use:

await this.MyMapView.SetViewpointScaleAsync(scale);


Best regards,

Volker

MattiasWesterberg
New Contributor III
What I want to do is to add a Graphic object and give it ZIndex 1.

Then I want to add a FeatureLayer for a shapefile and set its ZIndex to 2.

And then i want to add another Graphic object and give it ZIndex 3.

0 Kudos
dotMorten_esri
Esri Notable Contributor

I'm not quite following the relationship between mapview scale and ZIndex on features on your features and graphics, but having said that, you can only control the ZIndex within a single graphics overlay, and graphics always goes on top of feature layers, so there's no way to have a feature in-between two graphics.

PreetiMaske
Esri Contributor

To get current scale of the map use `GeoView.GetCurrentViewpoint` and with ViewpointType as `CenterAndScale` 
https://developers.arcgis.com/net/api-reference/api/netwin/wpf/Esri.ArcGISRuntime.UI.Controls.GeoVie...