It's expected behavior that scalebar disappears when zooming out to level 1 or 2 of the world map. We did it on purpose since there is no accurate scale value when the map covers the whole world. But it should come back when zooming in again. If it's not the case, please provide a reproducible case. Thanks a lot.
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" /> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/> <title></title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/dojo/dijit/themes/tundra/tundra.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/esri/dijit/css/Popup.css"> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map{ margin: 0; padding: 0; } </style> <script>var dojoConfig = { parseOnLoad: true };</script> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5"></script> <script> dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("esri.map"); dojo.require("esri.dijit.Scalebar"); var map; function init() { // var initExtent = new esri.geometry.Extent({"xmin":-17878954,"ymin":-2368856,"xmax":11003235,"ymax":12170078,"spatialReference":{"wkid":102100}}); var initExtent = new esri.geometry.Extent({"xmin":-4414756,"ymin":-4416634,"xmax":16092382,"ymax":9032981,"spatialReference":{"wkid":102100}}); map = new esri.Map("map",{ extent:initExtent, wrapAround180: true }); var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"); map.addLayer(basemap); dojo.connect(map, 'onLoad', function() { dojo.connect(dijit.byId('map'), 'resize', map, map.resize); var scalebar = new esri.dijit.Scalebar({ map: map, scalebarUnit:'metric' }); }); } dojo.ready(init); </script> </head> <body class="tundra"> <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline',gutters:false" style="width: 100%; height: 100%; margin: 0;"> <div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> </div> </div> </body> </html>
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.