<?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 Re: access scale-bar value in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659823#M87746</link>
    <description>&lt;P&gt;I did use &lt;SPAN&gt;`await scaleBar.componentOnReady()` but is not working.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank you for clarifying the reason behind the mismatch between the scale shown by the scale bar and the map view. It appears that I’ll need to find a way to access the value displayed on the scale bar, since that’s what users actually see.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Oct 2025 22:33:08 GMT</pubDate>
    <dc:creator>LefterisKoumis</dc:creator>
    <dc:date>2025-10-22T22:33:08Z</dc:date>
    <item>
      <title>access scale-bar value</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659495#M87739</link>
      <description>&lt;P&gt;I used to get the value of the scale bar widget,&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const scaleText = scaleBar.container.innerText.trim();&lt;/LI-CODE&gt;&lt;P&gt;however, with the new scale-bar component, it seems that you cannot directly access its value.&lt;/P&gt;&lt;P&gt;I suppose you need to get the scale from the arcgis-map component but sometimes it doesn't sync with the display of the scale value. Is there way to access the scale bar value?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 23:19:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659495#M87739</guid>
      <dc:creator>LefterisKoumis</dc:creator>
      <dc:date>2025-10-21T23:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: access scale-bar value</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659508#M87740</link>
      <description>&lt;P&gt;If you want to do something similar to your snippet above (just snagging the text from the DOM), this should work:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const map = document.querySelector('arcgis-map');
await map.viewOnReady();

const scaleBar = document.querySelector('arcgis-scale-bar');
await scaleBar.componentOnReady();
const scaleText = scaleBar.shadowRoot.querySelector('.esri-scale-bar').textContent.trim();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd recommend using the `view` property of the arcgis-scale-bar component to access the MapView and getting the scale that way instead, though.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2025 00:22:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659508#M87740</guid>
      <dc:creator>fdeters</dc:creator>
      <dc:date>2025-10-22T00:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: access scale-bar value</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659691#M87742</link>
      <description>&lt;P&gt;Could you provide a use case for how you would use the value? I haven't seen this request before, but we can look at adding it if we know what the use case is.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2025 16:54:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659691#M87742</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2025-10-22T16:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: access scale-bar value</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659699#M87743</link>
      <description>&lt;P&gt;I have a tool that I require the users to zoom in to the area of interest beyond a specific scale so they can click at the correct location. Yes, users could monitor the scale bar display to see what is the current scale, but there are those who do not. So, in the tool panel I have the display of the current scale.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LefterisKoumis_1-1761153170115.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/142377iEA0DF98820B9FC7E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LefterisKoumis_1-1761153170115.png" alt="LefterisKoumis_1-1761153170115.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2025 17:14:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659699#M87743</guid>
      <dc:creator>LefterisKoumis</dc:creator>
      <dc:date>2025-10-22T17:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: access scale-bar value</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659712#M87744</link>
      <description>&lt;P&gt;Thank you for your response. I implemented your solution but the shadowRoot was null.&lt;/P&gt;&lt;P&gt;Then, I tried to access the view property of the arcgis-scale-bar and then sub-property viewpoint and I get the scale attribute. However, I noticed that displayed scale and the scalebar.view.viewpoint.scale do not match. For example, when the map scale on the map shows 20mi, the scale from the viewpoint is&amp;nbsp;2311162.2171545 which translates to 36.48 mil&lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2025 18:28:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659712#M87744</guid>
      <dc:creator>LefterisKoumis</dc:creator>
      <dc:date>2025-10-22T18:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: access scale-bar value</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659770#M87745</link>
      <description>&lt;P&gt;Hmmm, that's unexpected. Just to check—did you do `await scaleBar.componentOnReady()` before attempting to access the shadowRoot? This is a method I use regularly for accessing Calcite and ArcGIS web components' shadow DOMs.&lt;/P&gt;&lt;P&gt;As for the mismatch between the view scale and the scale bar text: I think it's appropriate that they don't match. Here's my reasoning:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The MapView's scale is the actual precise map scale (e.g. 1:2,311,162.2171545 in your example).&lt;/LI&gt;&lt;LI&gt;The value displayed in the scale bar isn't really the map's scale, it's the length of the scale bar itself at the current map scale. So in your example, at the scale 1:2,311,162.2171545, the scale bar covers the equivalent of 20 miles on the map.&lt;UL&gt;&lt;LI&gt;You can see the scale bar change length as you scroll in and out of the map. This is why you always see nice round numbers in the scale bar—it dynamically adjusts its own length to give a useful visual reference for the current scale.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 22 Oct 2025 19:47:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659770#M87745</guid>
      <dc:creator>fdeters</dc:creator>
      <dc:date>2025-10-22T19:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: access scale-bar value</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659823#M87746</link>
      <description>&lt;P&gt;I did use &lt;SPAN&gt;`await scaleBar.componentOnReady()` but is not working.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank you for clarifying the reason behind the mismatch between the scale shown by the scale bar and the map view. It appears that I’ll need to find a way to access the value displayed on the scale bar, since that’s what users actually see.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2025 22:33:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-scale-bar-value/m-p/1659823#M87746</guid>
      <dc:creator>LefterisKoumis</dc:creator>
      <dc:date>2025-10-22T22:33:08Z</dc:date>
    </item>
  </channel>
</rss>

