Select to view content in your preferred language

Zoom Scale bar - show zoom level  Label on change of scale in zoom slider bar

1149
1
04-13-2011 09:19 AM
nidhiarora
Deactivated User
Hi

I want the zoom slider bar to display the scale when it is moved up or down . Is there any event which can capture this?
i looked into API , i am able to follow the sample available to show labels in zoom slider bar . Is it feasible to show label in zoom slider bar when user has zoomed to that level , instead of showing labels for all the levels.

Something like zoom slider bar which is available in flex

regards,
Nidhi Arora
0 Kudos
1 Reply
VipulJajal
New Contributor
I achieved this as follows.

On the form, I had the dedicated input box labelled as "Approximate Scale:"

First register the event "onZoomEnd" on the map as follows:

  dojo.connect(map, "onZoomEnd", showMapScale);

The JavaScript function "showMapScale" is shown below:


function showMapScale(extent, zoomFactor, anchor, level) {

var scale = tiledMapService.tileInfo.lods[level].scale;

dojo.byId("scaleText").value = "1:" + scale;

}

Here tiledMapService is the ArcGISTiledMapServiceLayer displaying the base map.

tiledMapService = new esri.layers.ArcGISTiledMapServiceLayer(primaryMapServiceURL);

This way, you can display the scale.

Not exactly the way you want but hope this helps.
0 Kudos