Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

In ArcGIS JS API, I would like to know and display the scale of a dynamic service layer by using the onExtentChange event, but the LOD argument is only valid for tile map services. Is there an equivalent way for dynamic map services?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The scale property applies to the map, not the individual layer, so you can use map.getScale() to display it.

You can get the map's level using map.getLevel(), but as you identified this only applies if there is a tiled layer in the map.

share|improve this answer
    
Thanks, Stephen.map.getScale() was introduced only in 3.1, and I am only using 2.8. Is there be an alternative way prior to 3.1? –  NeoJigglypuff Oct 15 '12 at 5:58
    
@NeoJigglypuff not sure, sorry. Is there any reason why you can't just upgrade? I've found it to be a very seamless process. Basically, you just need to change the reference from 2.8 to 3.x, noting that you'll need to use a local web server (rather than files in the file system) for local testing. See the migrating doco for details –  Stephen Lead Oct 15 '12 at 6:07
    
Upgrading from one version to another, though as simple as it may seem, will have an effect on all of our applications, with the retesting and QAs involved. Though it's good to know that a getScale method is present in 3.1. Thanks again. –  NeoJigglypuff Oct 15 '12 at 6:35
2  
There's also esri.geometry.getScale which has been around longer than esri.Map.getScale: help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/… –  Derek Swingley Oct 15 '12 at 7:33
    
That works for me. Thanks! –  NeoJigglypuff Oct 16 '12 at 0:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.