Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The trouble is nearly to come with the amount of data retrieved by the browser and displayed. FeatureLayer is limited in number of detailed features displayed at once.</p> <p>But the server is helpful at this point, you ask the server to generalize on the fly the geometries. This reduce a lot the geometry volume depending on the scale.</p> <p>in your code, you can use the <strong>setAutoGeneralize(enable)</strong> to true on the <strong>FeatureLayer</strong>. you can also set a minsccale and maxscale of the feature layer to avoid display the scales on which you have a lot of geometries.</p> <p><a href="https://developers.arcgis.com/en/javascript/jsapi/featurelayer-amd.html#featurelayer2" rel="nofollow">Documentation on FeatureLayer, and setAutoGeneralize method/option</a></p> <p>autoGeneralize option in constructor :</p> <blockquote> <p> autoGeneralize Enable or disable the auto generalization of features from a non-editable layer in on-demand mode. When true, the layer uses the current map resolution as the maxAllowableOffset for all queries issued to the server. The default value is true. As of v2.7</p> </blockquote> <p>by using this code to choose the generalization parameter (max allowableOffset), could reduce the amont of datas transferred to the browser, and gaining in user experience.</p> <pre><code> &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10"&gt; &lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"&gt; &lt;title&gt;Feature Layer Only Map&lt;/title&gt; &lt;link rel="stylesheet" href="http://js.arcgis.com/3.6/js/esri/css/esri.css"&gt; &lt;style&gt; html, body, #map { height: 100%; width: 100%; margin: 0; padding: 0; } &lt;/style&gt; &lt;script src="http://js.arcgis.com/3.6/"&gt;&lt;/script&gt; &lt;script&gt; var map; require(["dojo/on","esri/config", "esri/map", "dojo/domReady!","esri/layers/ArcGISDynamicMapServiceLayer","esri/layers/FeatureLayer","esri/InfoTemplate" ], function(on,config, Map,Ready,ArcGISDynamicMapServiceLayer,FeatureLayer,InfoTemplate) { config.defaults.io.alwaysUseProxy = true; config.defaults.io.proxyUrl = "/proxy.jsp"; config.defaults.io.corsEnabledServers.push("sampleserver1.arcgisonline.com"); map = new Map("map", { lods : [ {"level" : 0, "resolution" : 0.010986328125, "scale" : 4617149.97766929}, {"level" : 1, "resolution" : 0.0054931640625, "scale" : 2308574.98883465}, {"level" : 2, "resolution" : 0.00274658203125, "scale" : 1154287.49441732}, {"level" : 3, "resolution" : 0.001373291015625, "scale" : 577143.747208662}, {"level" : 4, "resolution" : 0.0006866455078125, "scale" : 288571.873604331} ] }); var layer = new ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"); map.addLayer(layer); layer.setVisibility(false); var url = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/3"; var info_content = "&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;COUNTRY :&lt;/b&gt;&lt;/td&gt;&lt;td style='text-align:right'&gt;${COUNTRY}&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"; var infoTemplate1 = new InfoTemplate("${STATE_NAME}", info_content); var fl = new FeatureLayer(url, { id: "usa-regions", mode: FeatureLayer.MODE_ONDEMAND, autoGeneralize:false, allowGeometryUpdates:false, infoTemplate: infoTemplate1, outFields: ["STATE_NAME"], maxAllowableOffset : 0.02 }); on(map,"zoom-end", function(evt) { fl.setMaxAllowableOffset(evt.extent.getWidth() / 400); }); map.addLayer(fl); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="elements"&gt;&lt;/div&gt; &lt;div id="map"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload