<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic display zoom scale on map in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-zoom-scale-on-map/m-p/1160186#M76896</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Is there a way to display the current zoom scale on the map ? im using the zoom widget, but it only have the zoom in and out button&lt;/P&gt;</description>
    <pubDate>Fri, 01 Apr 2022 07:10:51 GMT</pubDate>
    <dc:creator>EvelynA</dc:creator>
    <dc:date>2022-04-01T07:10:51Z</dc:date>
    <item>
      <title>display zoom scale on map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-zoom-scale-on-map/m-p/1160186#M76896</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Is there a way to display the current zoom scale on the map ? im using the zoom widget, but it only have the zoom in and out button&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 07:10:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-zoom-scale-on-map/m-p/1160186#M76896</guid>
      <dc:creator>EvelynA</dc:creator>
      <dc:date>2022-04-01T07:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: display zoom scale on map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-zoom-scale-on-map/m-p/1160231#M76898</link>
      <description>&lt;P&gt;Evelyn,&lt;/P&gt;&lt;P&gt;Are you wanting a tool where you can zoom to a specific scale on the map?&amp;nbsp; &amp;nbsp; It would be nice is this was a widget.&amp;nbsp; We built a tool where you can enter in the scale (in feet) and it will zoom to that scale on the map.&amp;nbsp; The current zoom scale in feet will update as well on the map when you perform a zoom in or out.&amp;nbsp; It looks something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IanPeebles_0-1648819047981.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/37950iF369029ADA55904D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IanPeebles_0-1648819047981.png" alt="IanPeebles_0-1648819047981.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When zooming again:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IanPeebles_1-1648819077259.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/37951i069A166864F3178C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IanPeebles_1-1648819077259.png" alt="IanPeebles_1-1648819077259.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then when zooming out:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IanPeebles_2-1648819105994.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/37952iEF26966A5C409489/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IanPeebles_2-1648819105994.png" alt="IanPeebles_2-1648819105994.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the entire Zoom to Scale tool:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IanPeebles_0-1648816990469.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/37946i340AC8248E74A1BA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IanPeebles_0-1648816990469.png" alt="IanPeebles_0-1648816990469.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can then type in the scale:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IanPeebles_1-1648817015209.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/37947iDEBA814FA79789A0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IanPeebles_1-1648817015209.png" alt="IanPeebles_1-1648817015209.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The map will zoom to that scale:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IanPeebles_2-1648817045559.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/37948i03A3F7A35E6C2878/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IanPeebles_2-1648817045559.png" alt="IanPeebles_2-1648817045559.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is the code block used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Javascript&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;// Map - Define Scale&lt;BR /&gt;mapView.scale = 96000;&lt;BR /&gt;console.log("The initial map scale is 1:" + mapView.scale);&lt;BR /&gt;var scaleInFeet = mapView.scale/12&lt;BR /&gt;&lt;BR /&gt;// Watch for the Scale on the Extent Change&lt;BR /&gt;mapView.watch('extent', function(){&lt;BR /&gt;var convertMapScale = mapView.scale/12;&lt;BR /&gt;var roundScale = Math.round(convertMapScale);&lt;BR /&gt;returnZoomScaleResult = document.getElementById("zoomToScaleResults");&lt;BR /&gt;returnZoomScaleResult.innerHTML = roundScale + " feet";&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;// Connect Zoom to Scale Button to Function&lt;BR /&gt;on(dom.byId("zoomToScaleBtn"), "click", zoomToScale);&lt;BR /&gt;&lt;BR /&gt;// Zoom to Map Scale Function&lt;BR /&gt;function zoomToScale() {&lt;BR /&gt;// If no value is added in&lt;BR /&gt;if (document.getElementById("zoomToScaleValue").value=="") {&lt;BR /&gt;// Alert when Scale Value is left Blank&lt;BR /&gt;enterScaleDialog = new Dialog({&lt;BR /&gt;title: "Zoom to Scale",&lt;BR /&gt;content: "You must enter a zoom to scale value then hit enter or use the magnifying glass. Example: 1000, 2000, or 5000. All units are in feet.",&lt;BR /&gt;style: "width: 300px; height: 150px;"&lt;BR /&gt;});&lt;BR /&gt;enterScaleDialog.show();&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;var zoom = document.getElementById("zoomToScaleValue").value*12;&lt;BR /&gt;mapView.scale = zoom;&lt;BR /&gt;var mapScaleInFeet = zoom/12;&lt;BR /&gt;}&lt;BR /&gt;console.log("ZOOM TO SCALE: The zoom level is 1:" + zoom + ".");&lt;BR /&gt;console.log("ZOOM TO SCALE: The zoom scale in feet is 1 inch = " + mapScaleInFeet + " feet.")&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;HTML&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Zoom to Scale Input Box and Button Map Toolbar DIV (HTML)&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;div id="mapViewToolHeaderDIV"&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;!-- Zoom to Scale Tool Title --&amp;gt;&lt;BR /&gt;&amp;lt;div id="zoomToScaleToolTitle"&amp;gt;&amp;lt;center&amp;gt;Zoom to Scale&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;!-- Zoom to Scale Tool DIV --&amp;gt;&lt;BR /&gt;&amp;lt;div id="zoomToScaleDIV"&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;!-- Zoom to Scale Tool - Text Input --&amp;gt;&lt;BR /&gt;&amp;lt;input type="search" id="zoomToScaleValue" placeholder=" Zoom to Scale: 1 inch = Feet" onkeypress="if (event.keyCode == 13) document.getElementById('zoomToScaleBtn').click()"/&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;!-- Zoom to Scale Tool - Button (to Execute)--&amp;gt;&lt;BR /&gt;&amp;lt;div id="zoomToScaleBtn"&amp;gt;&lt;BR /&gt;&amp;lt;div id="zoomToScaleBtnText"&amp;gt;&amp;lt;center&amp;gt;Go&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Zoom to Scale Results on Map (HTML)&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;div id="zoomToScaleFrame"&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;!-- Zoom to Scale Map Scale Title --&amp;gt;&lt;BR /&gt;&amp;lt;div id="zoomToScaleTitle"&amp;gt;1 inch =&amp;lt;/div&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;!-- Zoom to Scale Value --&amp;gt;&lt;BR /&gt;&amp;lt;div id="zoomToScaleResults"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CSS&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;#zoomToScaleFrame{&lt;BR /&gt;z-index: 2;&lt;BR /&gt;position: absolute;&lt;BR /&gt;width: 150px;&lt;BR /&gt;left: 10px;&lt;BR /&gt;bottom: 32px;&lt;BR /&gt;height: 17px;&lt;BR /&gt;border: 1px solid none;&lt;BR /&gt;font-size: 10pt;&lt;BR /&gt;background-color: white;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#zoomToScaleTitle{&lt;BR /&gt;z-index: 2;&lt;BR /&gt;margin-left: 1px;&lt;BR /&gt;margin-top: 1px;&lt;BR /&gt;height: 11px;&lt;BR /&gt;width: 43px;&lt;BR /&gt;font-family: arial;&lt;BR /&gt;font-size: 8pt;&lt;BR /&gt;color: black;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#zoomToScaleResults{&lt;BR /&gt;margin-left: 44px;&lt;BR /&gt;margin-top: -11px;&lt;BR /&gt;width: 70px;&lt;BR /&gt;height: 11px;&lt;BR /&gt;font-family: arial;&lt;BR /&gt;font-size: 8pt;&lt;BR /&gt;color: black;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* Zoom to Scale - Tool Title */&lt;BR /&gt;#zoomToScaleToolTitle{&lt;BR /&gt;z-index: 2;&lt;BR /&gt;position: absolute;&lt;BR /&gt;top: 0px;&lt;BR /&gt;line-height: 1;&lt;BR /&gt;left: 8px;&lt;BR /&gt;height: 10px;&lt;BR /&gt;font-size: 10pt;&lt;BR /&gt;font-weight: bold;&lt;BR /&gt;color: white;&lt;BR /&gt;width: 235px;&lt;BR /&gt;/* Make Text Unselectable */&lt;BR /&gt;-moz-user-select: none;&lt;BR /&gt;-khtml-user-select: none;&lt;BR /&gt;-webkit-user-select: none;&lt;BR /&gt;-o-user-select: none;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#zoomToScaleDIV{&lt;BR /&gt;position: absolute;&lt;BR /&gt;padding: 0;&lt;BR /&gt;margin: 0;&lt;BR /&gt;right: 0px;&lt;BR /&gt;bottom: 1px;&lt;BR /&gt;left: 8px;&lt;BR /&gt;height: 35px;&lt;BR /&gt;width: 235px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* Zoom to Scale Tool - Text Input */&lt;BR /&gt;#zoomToScaleValue{&lt;BR /&gt;position: absolute;&lt;BR /&gt;padding: 0;&lt;BR /&gt;margin: 0;&lt;BR /&gt;right: 0px;&lt;BR /&gt;top: 1px;&lt;BR /&gt;left: 2px;&lt;BR /&gt;height: 30px;&lt;BR /&gt;width: 180px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* Zoom to Scale Tool - Button (to Execute) */&lt;BR /&gt;#zoomToScaleBtn{&lt;BR /&gt;position: absolute;&lt;BR /&gt;padding: 0;&lt;BR /&gt;margin: 0;&lt;BR /&gt;right: 0px;&lt;BR /&gt;top: 1px;&lt;BR /&gt;left: 190px;&lt;BR /&gt;height: 30px;&lt;BR /&gt;width: 30px;&lt;BR /&gt;border-radius: 4px;&lt;BR /&gt;background-color: #EEEEEE;&lt;BR /&gt;/* Make Text Unselectable */&lt;BR /&gt;-moz-user-select: none;&lt;BR /&gt;-khtml-user-select: none;&lt;BR /&gt;-webkit-user-select: none;&lt;BR /&gt;-o-user-select: none;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* Zoom to Scale Tool - Button Text */&lt;BR /&gt;#zoomToScaleBtnText{&lt;BR /&gt;position: absolute;&lt;BR /&gt;padding: 0;&lt;BR /&gt;margin: 0;&lt;BR /&gt;right: 2px;&lt;BR /&gt;top: 5px;&lt;BR /&gt;left: 2px;&lt;BR /&gt;bottom: 2px;&lt;BR /&gt;font-size: 11pt;&lt;BR /&gt;font-weight: bold;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This tool has worked really well for us.&amp;nbsp; May give you some ideas.&lt;/P&gt;&lt;P&gt;Ian Peebles, GISP&lt;/P&gt;&lt;P&gt;GIS Analyst II&lt;/P&gt;&lt;P&gt;Application Support Team – Information Technology&lt;/P&gt;&lt;P&gt;1273 N Broadway, Edmond, OK 73034&lt;BR /&gt;(405) 359-4561&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 13:20:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-zoom-scale-on-map/m-p/1160231#M76898</guid>
      <dc:creator>IanPeebles</dc:creator>
      <dc:date>2022-04-01T13:20:38Z</dc:date>
    </item>
  </channel>
</rss>

