<?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 Visualizing features in Javascript 4.x (laggy map) in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/visualizing-features-in-javascript-4-x-laggy-map/m-p/287322#M26451</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im working with the Javascript API 4.4 visualizing features on the map depending on a query.&lt;/P&gt;&lt;P&gt;The map is lagging while panning and zooming depending on the amount of features / size of the browser window and level of zoom. I am using Chrome as a browser.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried 2 things to visualize the features:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Load the feature layer and do a definitionExpression by property afterwards.&amp;nbsp;&amp;nbsp;- This seemed to be a bad idea because when panning the map the query was executed again to fetch the features from the server.&lt;/LI&gt;&lt;LI&gt;Create a query on the feature layer with a definitionExpression and than loop through all features on the feature service and add them to a graphicLayer.&lt;/LI&gt;&lt;/OL&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;rooms&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;queryFeatures&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;query1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&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;result&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; i &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; result&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;features&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;length&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; i&lt;SPAN class="operator token"&gt;++&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;addGraphicsToLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;result&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;features&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;i&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;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; roomsGraphic&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;visible &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;true&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;&lt;/P&gt;&lt;P&gt;The addGraphicsToLayer() handles the symbolization based on attributes of the feature. Following the feature is added to the GraphicsLayer&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;roomsGraphic&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;add&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feature&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In both cases the map gets laggy while in 3.x i was able to create a smooth map with even more features from other services using "mode: esri.layers.FeatureLayer.MODE_SELECTION" (&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/featurelayer.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Feature Service 3.x&lt;/A&gt;) &amp;nbsp;on each feature layer.&lt;/P&gt;&lt;P&gt;Is there another possibility to visualize features with a better performance on the view or am i missing something else?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wiard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 13:53:19 GMT</pubDate>
    <dc:creator>LageplanGöttingen</dc:creator>
    <dc:date>2021-12-11T13:53:19Z</dc:date>
    <item>
      <title>Visualizing features in Javascript 4.x (laggy map)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/visualizing-features-in-javascript-4-x-laggy-map/m-p/287322#M26451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im working with the Javascript API 4.4 visualizing features on the map depending on a query.&lt;/P&gt;&lt;P&gt;The map is lagging while panning and zooming depending on the amount of features / size of the browser window and level of zoom. I am using Chrome as a browser.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried 2 things to visualize the features:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Load the feature layer and do a definitionExpression by property afterwards.&amp;nbsp;&amp;nbsp;- This seemed to be a bad idea because when panning the map the query was executed again to fetch the features from the server.&lt;/LI&gt;&lt;LI&gt;Create a query on the feature layer with a definitionExpression and than loop through all features on the feature service and add them to a graphicLayer.&lt;/LI&gt;&lt;/OL&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;rooms&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;queryFeatures&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;query1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&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;result&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; i &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; result&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;features&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;length&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; i&lt;SPAN class="operator token"&gt;++&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;addGraphicsToLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;result&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;features&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;i&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;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; roomsGraphic&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;visible &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;true&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;&lt;/P&gt;&lt;P&gt;The addGraphicsToLayer() handles the symbolization based on attributes of the feature. Following the feature is added to the GraphicsLayer&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;roomsGraphic&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;add&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feature&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In both cases the map gets laggy while in 3.x i was able to create a smooth map with even more features from other services using "mode: esri.layers.FeatureLayer.MODE_SELECTION" (&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/featurelayer.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Feature Service 3.x&lt;/A&gt;) &amp;nbsp;on each feature layer.&lt;/P&gt;&lt;P&gt;Is there another possibility to visualize features with a better performance on the view or am i missing something else?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wiard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:53:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/visualizing-features-in-javascript-4-x-laggy-map/m-p/287322#M26451</guid>
      <dc:creator>LageplanGöttingen</dc:creator>
      <dc:date>2021-12-11T13:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: Visualizing features in Javascript 4.x (laggy map)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/visualizing-features-in-javascript-4-x-laggy-map/m-p/287323#M26452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I solved the problem by using a MapImageLayer for the visualization, controlling the content by .definitionExpression. Clicking on the map i query the feature service for the geoemtry of the map point.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Aug 2017 01:50:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/visualizing-features-in-javascript-4-x-laggy-map/m-p/287323#M26452</guid>
      <dc:creator>LageplanGöttingen</dc:creator>
      <dc:date>2017-08-21T01:50:02Z</dc:date>
    </item>
  </channel>
</rss>

