<?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 can I &amp;quot;lazy load&amp;quot; a feature layer? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594301#M55673</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd question whether you'll actually gain anything noticeable from not requesting the service JSON until it's required. &amp;nbsp;All of this data&amp;nbsp;is requested asynchronously, so&amp;nbsp;I'd be surprised if it slowed down your&amp;nbsp;app or damaged user experience to load the service JSON before anything needs to be drawn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, if you defer loading the service JSON until the user decides to view the layer, you'll increase the delay between the user&amp;nbsp;clicking "view layer" and them seeing features on the map compared to just toggling the layer's visibility. &amp;nbsp;This is because feature layers need to make a couple requests end-to-end before anything is drawn, and the first of those requests, fetching the layer JSON, would already have been made if you just toggled visibility.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're dead set on not making requests for data you may not need, one option would just be not adding the layer to the map. &amp;nbsp;You can create a new Feature Layer, show it in a list, but only add it to the map the first time a user decides to view it. &amp;nbsp;This will prevent any&amp;nbsp;requests to the feature service until the layer is added, at least in 4.XX.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Oct 2017 18:00:08 GMT</pubDate>
    <dc:creator>ThomasSolow</dc:creator>
    <dc:date>2017-10-16T18:00:08Z</dc:date>
    <item>
      <title>How can I "lazy load" a feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594293#M55665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the best way to lazy load a feature layer for a map?&amp;nbsp; In my application, I have a map and handful of layers, some are turned off by default on launch.&amp;nbsp; These feature service layers that are off by default I would like to delay loading until the user clicks that layer's on/off check box.&amp;nbsp; Is this possible within the ArcGIS Online JS API?&amp;nbsp; The solution I've brainstormed so far is to set the layer's url to an empty feature service when the layer is first instantiated.&amp;nbsp; Inside the checkBox.on("change") function I would change the url to the correct feature service url, refresh() the layer, then proceed with the rest of the code that handles the layer rendering and tables.&amp;nbsp; I don't want to reinvent the wheel when possible, so I'm looking for a documented or better way of handling this while I roll my own solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Oct 2017 21:17:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594293#M55665</guid>
      <dc:creator>mfcallahan</dc:creator>
      <dc:date>2017-10-15T21:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: How can I "lazy load" a feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594294#M55666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Matthew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;The JS API does not attempt to do much with the layer until it is set to visible. The only request I know that it does is to get the layers properties/capabilities using the layers url with ?f=json. It basically does a lazy load of the layer until it is set to visible and then requests geometry from the server. Are you noticing some different behavior?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Oct 2017 13:16:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594294#M55666</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2017-10-16T13:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: How can I "lazy load" a feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594295#M55667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply, I had a suspicion that setting the "visible" property to false was already doing what I was attempting to accomplish.&amp;nbsp; I had been tasked with making sure all the application resources are loaded efficiently, and was asked to explore if there's any improvement/benefit of attempting to lazy (or partially) load a feature layer, delaying any heavy lifting until after the user clicks the layer on/off checkbox.&amp;nbsp; But it appears that is already the case, so no need for me to reinvent the wheel here!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Oct 2017 14:52:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594295#M55667</guid>
      <dc:creator>mfcallahan</dc:creator>
      <dc:date>2017-10-16T14:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: How can I "lazy load" a feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594296#M55668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't forget to mark this question as answered by clicking on the "Correct Answer" link on the reply that answered your question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Oct 2017 14:58:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594296#M55668</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2017-10-16T14:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can I "lazy load" a feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594297#M55669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Upon further inspection, I can see that layers I have set to visible = false are still being loaded as a resource, and some like the Esri demographic layer are taking 2+ seconds to load.&amp;nbsp; Without knowing a whole lot about the JS API, I would say that based on what I see, setting the visible property to false doesn't actually do anything to lazy load or otherwise reduce the time needed to load a feature layer resource.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Oct 2017 16:06:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594297#M55669</guid>
      <dc:creator>mfcallahan</dc:creator>
      <dc:date>2017-10-16T16:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I "lazy load" a feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594298#M55670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Matthew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;When you look at your browsers network tab what requests are you seeing go to the server for that layer?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Oct 2017 16:09:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594298#M55670</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2017-10-16T16:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: How can I "lazy load" a feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594300#M55672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Matthew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;So this is the one expected call to the map service to get the details about the layer in json format.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fdemographics7.arcgis.com%2Farcgis%2Frest%2Fservices%2FUSA_Demographics_and_Boundaries_2017%2FMapServer%2F2%3Ff%3Djson" rel="nofollow" target="_blank"&gt;https://demographics7.arcgis.com/arcgis/rest/services/USA_Demographics_and_Boundaries_2017/MapServer/2?f=json&lt;/A&gt;&lt;BR /&gt;The API has to make this one call to get basic info about the layer. You just happen to be using a layer that has LOTS of fields and is a slower service.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Oct 2017 16:42:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594300#M55672</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2017-10-16T16:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: How can I "lazy load" a feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594301#M55673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd question whether you'll actually gain anything noticeable from not requesting the service JSON until it's required. &amp;nbsp;All of this data&amp;nbsp;is requested asynchronously, so&amp;nbsp;I'd be surprised if it slowed down your&amp;nbsp;app or damaged user experience to load the service JSON before anything needs to be drawn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, if you defer loading the service JSON until the user decides to view the layer, you'll increase the delay between the user&amp;nbsp;clicking "view layer" and them seeing features on the map compared to just toggling the layer's visibility. &amp;nbsp;This is because feature layers need to make a couple requests end-to-end before anything is drawn, and the first of those requests, fetching the layer JSON, would already have been made if you just toggled visibility.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're dead set on not making requests for data you may not need, one option would just be not adding the layer to the map. &amp;nbsp;You can create a new Feature Layer, show it in a list, but only add it to the map the first time a user decides to view it. &amp;nbsp;This will prevent any&amp;nbsp;requests to the feature service until the layer is added, at least in 4.XX.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Oct 2017 18:00:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594301#M55673</guid>
      <dc:creator>ThomasSolow</dc:creator>
      <dc:date>2017-10-16T18:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I "lazy load" a feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594299#M55671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the request header:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="font-size: 11px;"&gt;&lt;SPAN&gt;GET /proxy/proxy.ashx?&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fdemographics7.arcgis.com%2Farcgis%2Frest%2Fservices%2FUSA_Demographics_and_Boundaries_2017%2FMapServer%2F2%3Ff%3Djson%26callback%3Ddojo.io.script.jsonp_dojoIoScript5._jsonpCallback" target="_blank"&gt;https://demographics7.arcgis.com/arcgis/rest/services/USA_Demographics_and_Boundaries_2017/MapServer/2?f=json&amp;amp;callback=dojo.io.script.jsonp_dojoIoScript5._jsonpCallback&lt;/A&gt;&lt;SPAN&gt; HTTP/1.1&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt;Host: myproxyserver.com&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt;Connection: keep-alive&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt;Pragma: no-cache&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt;Cache-Control: no-cache&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt;User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt;Accept: */*&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt;&lt;SPAN&gt;Referer: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Flocalhost%2Fmy_application" target="_blank"&gt;https://localhost/my_application&lt;/A&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt;Accept-Encoding: gzip, deflate, br&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt;Accept-Language: en-US,en;q=0.8&lt;/SPAN&gt;
&lt;SPAN style="font-size: 11px;"&gt;Cookie: [removed]
&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;And here is the response header:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="font-size: 11px;"&gt;HTTP/1.1 200 OK
Cache-Control: max-age=0,must-revalidate
Content-Type: text/plain;charset=utf-8
ETag: 6dfb1ba3
Vary: Origin
Server: Microsoft-IIS/8.5
Set-Cookie: AGS_ROLES="nGGHe9fnJdtqgrxv/F457aPODB3PII6+MSSUUbBUPUTFqmHBA0KbNNNKphQAiCnKG1HjLTBjpl0/sBdgKzNqdPYLY75CroUOHRS1I8+SG87wUFamgBZb7OKBemucaf3O/3MbDnjgy1VS02jMPpD3O9QK2LrPN/lN8P5gvUvHjB8FY19FcRB9SKLYwGievzdwfKT9kJyRGaUPfWHpL1SMJ+n9Pn+xGBREr+oTFHXazQBaD59XcKRqRpTvrB5bnIWcmGy6+jpfv11KySMB1lEO6I6ZOPEy8yCxyQJvB6Ebot8="; Version=1; Max-Age=60; Expires=Mon, 16-Oct-2017 16:21:41 GMT; Path=/arcgis/rest; HttpOnly
Server: 
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Access-Control-Allow-Origin: *
Date: Mon, 16 Oct 2017 16:20:39 GMT
Content-Length: 239728&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And here is a link to the body of the request - it's huge!&amp;nbsp;&lt;A class="jivelink11" href="https://pastebin.com/Zq0LAm8i" title="https://pastebin.com/Zq0LAm8i" rel="nofollow noopener noreferrer" target="_blank"&gt;https://pastebin.com/Zq0LAm8i&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm only specifying these layers, so I'm not sure why it's making such a huge request:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN&gt;outFields: ["NAME", "EMP_CY", "INDMANU_CY", "MEDHINC_CY", "OCCTRAN_CY", "POPDENS_CY", "POPGRWCYFY", "TOTHH_CY", "UNEMP_CY", "CIVLBFR_CY", "UNEMPRT_CY"]&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:40:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/594299#M55671</guid>
      <dc:creator>mfcallahan</dc:creator>
      <dc:date>2021-12-12T16:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can I "lazy load" a feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/1228576#M79245</link>
      <description>&lt;P&gt;What is 'lazy load' by the way?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 23:24:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-quot-lazy-load-quot-a-feature-layer/m-p/1228576#M79245</guid>
      <dc:creator>JingchaoZhou</dc:creator>
      <dc:date>2022-11-03T23:24:51Z</dc:date>
    </item>
  </channel>
</rss>

