How to get map scale

2449
4
10-13-2010 01:05 PM
AlessioDi_Lorenzo
New Contributor
Hi forum,

I'm developing an application template using the Javascript APIs v 2.1. and I would ask if is there a way to retrieve the map scale simply?
I cannot find any example or clear API documentation about this.
For example, in OpenLayers, you can obtain the current denominator of the map using the getScale() function.

Thx in advance
0 Kudos
4 Replies
AlexGray
New Contributor
Have you tried using class: LOD?

it has a property for scale..

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/lod.htm
0 Kudos
JianHuang
Occasional Contributor III
LOD normally only represents the scale value at equator area.
The accurate way is to send a request to geometry service to calculate the geodesic distance between two points, which are the lower-left and lower-right corners. Then divide it by the number of pixels of the map width. The result is the length represented by one pixel.
For Web Mercator or GCS coordinate systems, the client side geodesic length algorithm can be leveraged to eliminate the request to geometry service. Please see details at: http://forums.arcgis.com/threads/13979-Client-side-reprojection#3
0 Kudos
derekswingley1
Frequent Contributor
Don't forget about the getScale() method in the esri.geometry namespace.
0 Kudos
nicogis
MVP Frequent Contributor
I would like to add just that the monitor scale depends on the DPIs of the monitor and so, for an accurate scale, you should use this information too.
With a scale bar instead you can compensate this information.
0 Kudos