<?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: scale dependent visibility for graphics layer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/scale-dependent-visibility-for-graphics-layer/m-p/406689#M37518</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There's no built-in scale dependency for graphics layers (but there is for feature layers).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To do this, you'll need to check the map's scale when the zoom level changes. You can connect to &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/map.htm#onZoomEnd" rel="nofollow" target="_blank"&gt;onZoomEnd&lt;/A&gt;&lt;SPAN&gt;, check the &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/namespace_geometry.htm#getScale" rel="nofollow" target="_blank"&gt;map's scale&lt;/A&gt;&lt;SPAN&gt;, and toggle your graphics layer's visibility with &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/layer.htm#show" rel="nofollow" target="_blank"&gt;show&lt;/A&gt;&lt;SPAN&gt; or &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/layer.htm#hide" rel="nofollow" target="_blank"&gt;hide&lt;/A&gt;&lt;SPAN&gt; accordingly.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 May 2012 21:49:32 GMT</pubDate>
    <dc:creator>derekswingley1</dc:creator>
    <dc:date>2012-05-03T21:49:32Z</dc:date>
    <item>
      <title>scale dependent visibility for graphics layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/scale-dependent-visibility-for-graphics-layer/m-p/406688#M37517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I filled a new graphics layer with text symbols; one for each point in a feature layer. The below function works fine and the labels are displayed correctly in their +50,+50 offset location, but how do I control the graphics layer visibility based on scale? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;function createLabels(){&amp;nbsp; var queryTask = new esri.tasks.QueryTask("REST url");&amp;nbsp; var query = new esri.tasks.Query();&amp;nbsp; query.returnGeometry = true;&amp;nbsp; query.outFields = ["site_code"];&amp;nbsp; query.where = "site_code LIKE '%'";&amp;nbsp; queryTask.execute(query, function(featureSet){ &amp;nbsp; map.graphics.clear(); &amp;nbsp; var lbls = new esri.layers.GraphicsLayer(); &amp;nbsp; var font = new esri.symbol.Font("9px", esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_SMALLCAPS, esri.symbol.Font.WEIGHT_BOLDER); &amp;nbsp; for (var i=0, il=featureSet.features.length; i&amp;lt;il; i++) { &amp;nbsp;&amp;nbsp; var x = featureSet.features&lt;I&gt;.geometry.x + 50; &amp;nbsp;&amp;nbsp; var y = featureSet.features&lt;I&gt;.geometry.y + 50; &amp;nbsp;&amp;nbsp; featureSet.features&lt;I&gt;.geometry.x = x; &amp;nbsp;&amp;nbsp; featureSet.features&lt;I&gt;.geometry.y = y; &amp;nbsp;&amp;nbsp; var graphic = featureSet.features&lt;I&gt;.attributes.site_code; &amp;nbsp;&amp;nbsp; var textSymbol = new esri.symbol.TextSymbol(graphic, font, new dojo.Color([0, 0, 0])); &amp;nbsp;&amp;nbsp; var symb = featureSet.features&lt;I&gt;; &amp;nbsp;&amp;nbsp; symb.setSymbol(textSymbol); &amp;nbsp;&amp;nbsp; lbls.add(symb); &amp;nbsp; }; &amp;nbsp; map.addLayer(lbls);&amp;nbsp; }); }&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 21:38:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/scale-dependent-visibility-for-graphics-layer/m-p/406688#M37517</guid>
      <dc:creator>danbecker</dc:creator>
      <dc:date>2012-05-03T21:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: scale dependent visibility for graphics layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/scale-dependent-visibility-for-graphics-layer/m-p/406689#M37518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There's no built-in scale dependency for graphics layers (but there is for feature layers).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To do this, you'll need to check the map's scale when the zoom level changes. You can connect to &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/map.htm#onZoomEnd" rel="nofollow" target="_blank"&gt;onZoomEnd&lt;/A&gt;&lt;SPAN&gt;, check the &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/namespace_geometry.htm#getScale" rel="nofollow" target="_blank"&gt;map's scale&lt;/A&gt;&lt;SPAN&gt;, and toggle your graphics layer's visibility with &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/layer.htm#show" rel="nofollow" target="_blank"&gt;show&lt;/A&gt;&lt;SPAN&gt; or &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/layer.htm#hide" rel="nofollow" target="_blank"&gt;hide&lt;/A&gt;&lt;SPAN&gt; accordingly.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 21:49:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/scale-dependent-visibility-for-graphics-layer/m-p/406689#M37518</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-05-03T21:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: scale dependent visibility for graphics layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/scale-dependent-visibility-for-graphics-layer/m-p/406690#M37519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;works perfect...after setting var lbls globally. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.connect(map, "onZoomEnd", checkScale);
function checkScale(extent, zoomFactor, anchor, level){
 if (level &amp;gt; 7 &amp;amp;&amp;amp; level &amp;lt; 16){
&amp;nbsp; lbls.show()
 }
 else {
&amp;nbsp; lbls.hide()
 }
 //we can retreive the scale here, but level works just as well
 //var scale = esri.geometry.getScale(map)
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:29:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/scale-dependent-visibility-for-graphics-layer/m-p/406690#M37519</guid>
      <dc:creator>danbecker</dc:creator>
      <dc:date>2021-12-11T18:29:54Z</dc:date>
    </item>
  </channel>
</rss>

