What units are mapView.mapScale in? Is it feet, meters, something else?

2088
5
08-07-2017 12:04 PM
SteveHall1
New Contributor

Would like to display to the user the scale in feet...the number I'm seeing for mapScale is not feet as far as I can tell.

Tags (1)
0 Kudos
5 Replies
RyanOlson1
Esri Contributor

Map-scale is not in any unit. It's a ratio of the distance on the actual earth to distance on the device screen (map). So if the scale is 10,000. Then 10,000 inches on the earth is 1 inch on the screen (map). At the same time, if your scale is 10,000 then 10,000 feet on earth is the same as 1 foot on the screen (map). The units don't matter, it's the ratio. Typically we talk about inches with scale, probably because of a few different factors, like (1) it's easier to think about length on a screen/map in a small unit such as inches, and (2) easier to do actual conversion of map resolution (map-units per screen point) to map-scale because screen points are typically measured in dots-per-inch.

So Map-scale has no unit. But your map's spatial reference has a unit, which you can read about here: ArcGIS Runtime SDK for iOS: AGSSpatialReference Class Reference 

This means that when you observe coordinates for your map, they are in the unit of your spatial reference.

MarcWouters
New Contributor III

If you show a map without specifying a SpatialReference, how do you know what the distance is ?

In a simple application, I read the mapView's mapScale and plot it on the map in a textbox (like 1/mapScale).

I would assume that with a mapScale of 10000, 1 cm on the screen represents 10000 cm = 100 m in reality, so a street of 800 m would be shown 8 cm long ?

However, on my application it's nearly double that size (about 16 cm).

How can I know the exact distance of an object on the map, using mapScale() ?

0 Kudos
RyanOlson1
Esri Contributor

Even if you don't specify a spatial reference, your map has to operate under one. So once your map is loaded, it has a spatial reference. 

Measuring distance on a map is not something you'd really want to use map scale for. Map scale will give you a basic planar distance, which depending on the spatial reference is going to be inaccurate at certain locations on the globe.

If you want to measure between features, points on a map, etc., it's best to use the AGSGeometryEngine (ArcGIS Runtime SDK for iOS: AGSGeometryEngine Class Reference ).

If you want to see this in action with an out of the box component, please see our measure toolbar component. It's very easy to add to your app: arcgis-runtime-toolkit-ios/Documentation/MeasureToolbar at master · Esri/arcgis-runtime-toolkit-ios ... 

Ryan

MarcWouters
New Contributor III

Thanks for the update.

My real purpose was to measure a distance on the map, but to show a (more or less) accurate scale bar instead of just a number.

You refer to the toolkit for iOs, but the toolkit Qt doesn't seem to have the same functionality.

0 Kudos
RyanOlson1
Esri Contributor

Also - as an FYI - we have a Scalebar control for the MapView in our Toolkit. It's very easy to use, we have sample code showing how to use it: arcgis-runtime-toolkit-ios/Documentation/Scalebar at master · Esri/arcgis-runtime-toolkit-ios · GitH... 

0 Kudos