<?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: How to list all polygons in the feature layer? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-list-all-polygons-in-the-feature-layer/m-p/304062#M27933</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to get the list of features before adding it on Map?&amp;nbsp;&lt;/P&gt;&lt;P&gt;By using some AJAX or something.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Mar 2019 04:46:12 GMT</pubDate>
    <dc:creator>Valgenmap</dc:creator>
    <dc:date>2019-03-05T04:46:12Z</dc:date>
    <item>
      <title>How to list all polygons in the feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-list-all-polygons-in-the-feature-layer/m-p/304060#M27931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;arcgis‌&lt;/P&gt;&lt;P&gt;I have added FeatureLayer as below into the map,&lt;/P&gt;&lt;P&gt;var map = new Map("map", {&lt;BR /&gt;basemap: "streets-navigation-vector",&lt;BR /&gt;showLabels:false,&lt;BR /&gt;showAttribution: false,&lt;BR /&gt;slider: false,&lt;BR /&gt;center: [-122.45, 37.75],&lt;BR /&gt;zoom: 10,&lt;BR /&gt;minZoom: 2,&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;var selectedBoundaryServiceUrl = "https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/3";&lt;/P&gt;&lt;P&gt;var stateLayer = new esri.layers.FeatureLayer(selectedBoundaryServiceUrl, {&lt;BR /&gt;id: "Selected_Layer",&lt;BR /&gt;opacity: 0.7,&lt;BR /&gt;mode: esri.layers.FeatureLayer.MODE_AUTO,&lt;BR /&gt;outFields: ["*"],&lt;BR /&gt;infoTemplate: infoTemplate&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;g_esri.map.addLayer(stateLayer);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried below line of code to get array of&amp;nbsp;&lt;SPAN&gt;graphics in the layer.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;var listOfGraphics = map.getLayer("&lt;SPAN&gt;Selected_Layer&lt;/SPAN&gt;").graphics&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the output I'm&amp;nbsp;getting as "Zero"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here I'm adding the console output for reference.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2019 05:16:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-list-all-polygons-in-the-feature-layer/m-p/304060#M27931</guid>
      <dc:creator>Valgenmap</dc:creator>
      <dc:date>2019-02-07T05:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all polygons in the feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-list-all-polygons-in-the-feature-layer/m-p/304061#M27932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to wait until the map is loaded before attempting to access its graphics. If you use "map.addLayer", then you'll have to use syntax to check when the specific layer is loaded (since the event fires each time a layer is loaded, including basemap layers)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;    map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;addLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;featureLayer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;on&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'layer-add-result'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;addLayer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;addLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layer &lt;SPAN class="operator token"&gt;===&lt;/SPAN&gt; featureLayer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
        console&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;log&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;featureLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;graphics&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you could use "map.addLayers", which fires when all layers are loaded.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;    map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;addLayers&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;featureLayer&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;on&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'layers-add-result'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      console&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;log&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;featureLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;graphics&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:34:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-list-all-polygons-in-the-feature-layer/m-p/304061#M27932</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-11T14:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all polygons in the feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-list-all-polygons-in-the-feature-layer/m-p/304062#M27933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to get the list of features before adding it on Map?&amp;nbsp;&lt;/P&gt;&lt;P&gt;By using some AJAX or something.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2019 04:46:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-list-all-polygons-in-the-feature-layer/m-p/304062#M27933</guid>
      <dc:creator>Valgenmap</dc:creator>
      <dc:date>2019-03-05T04:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all polygons in the feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-list-all-polygons-in-the-feature-layer/m-p/304063#M27934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Valgen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Use esriRequest to make a service call to the rest endpoint for the MapService or FeatureService, with a query where of 1=1.&lt;/P&gt;&lt;P&gt;Here is a sample that shows that:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/3/jssamples/data_requestLayerInfo.html" title="https://developers.arcgis.com/javascript/3/jssamples/data_requestLayerInfo.html"&gt;Request layer info | ArcGIS API for JavaScript 3.27&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2019 15:02:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-list-all-polygons-in-the-feature-layer/m-p/304063#M27934</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-03-05T15:02:57Z</dc:date>
    </item>
  </channel>
</rss>

