<?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 scale marker size based on zoom? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-scale-marker-size-based-on-zoom/m-p/1049667#M72668</link>
    <description>&lt;P&gt;&lt;STRONG&gt;&amp;gt; Is there a way to make Graphics on a GraphicsLayer scale based on zoom? &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;No. There is no way to efficiently scale the symbols of graphics in the view graphics or in a GraphicsLayer.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;gt; If not, how could I modify the viewshed sample to use a FeatureLayer instead?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You will need to create a client-side feature layer and add a simple renderer to it using the code in the sample you referenced above. Undral's comment shows how you can create a feature layer using graphics. If this is only to display temporary results in the view, you can just construct the FeatureLayer and pass the graphics to the layer.source. When you want to clear the graphics, destroy the layer. That way you avoid using applyEdits.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The method of managing the graphics with applyEdits or creating a new layer every time is up to you.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Apr 2021 16:45:33 GMT</pubDate>
    <dc:creator>KristianEkenes</dc:creator>
    <dc:date>2021-04-21T16:45:33Z</dc:date>
    <item>
      <title>How to scale marker size based on zoom?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-scale-marker-size-based-on-zoom/m-p/1048561#M72618</link>
      <description>&lt;P data-unlink="true"&gt;I am creating a viewshed analysis application using &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/geoprocessing-viewshed/" target="_self"&gt;ArcGIS' Viewshed Sample.&lt;/A&gt;&amp;nbsp;My application involves placing multiple markers at specific locations and computing each marker's viewshed on load:&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function drawResultData(result) {
          var resultFeatures = result.results[0].value.features;

          // Assign each resulting graphic a symbol
          var viewshedGraphics = resultFeatures.map(function(feature) {
            feature.symbol = fillSymbol;
            return feature;
          });

          // Add the resulting graphics to the graphics layer
          graphicsLayer.addMany(viewshedGraphics);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The ArcGIS JS API has an &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/visualization-sm-location-scale/" target="_self"&gt;example&lt;/A&gt; of scaling markers based on zoom, but it uses a&amp;nbsp;&lt;SPAN&gt;SimpleRenderer that is passed into a FeatureLayer. Unfortunately, my application only uses GraphicsLayers, which do not support renderers. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is there a way to make Graphics on a GraphicsLayer scale based on zoom? If not, how could I modify the viewshed sample to use a FeatureLayer instead?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 18:46:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-scale-marker-size-based-on-zoom/m-p/1048561#M72618</guid>
      <dc:creator>Neocyte</dc:creator>
      <dc:date>2021-04-18T18:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to scale marker size based on zoom?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-scale-marker-size-based-on-zoom/m-p/1048771#M72632</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#client-side" target="_self"&gt;client-side FeatureLayer&lt;/A&gt; to achieve what you are asking. &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=layers-featurelayer-collection-edits" target="_self"&gt;This sample&lt;/A&gt; shows you how to create a client-side feature layer and add/remove features from it at runtime with the use of &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits" target="_self"&gt;FeatureLayer.applyEdits&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In any case, this is the workflow you can have.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Initialize an empty feature collection as shown below:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const layer = new FeatureLayer({
  fields: [
    {
      name: "ObjectID",
      alias: "ObjectID",
      type: "oid"
     },
     {
       name: "Name",
       alias: "Name",
       type: "string"
      },
      {
        name: "Type",
        alias: "Type",
        type: "string"
      }
  ],
  objectIdField: "ObjectID",
  geometryType: "point", // =&amp;gt;&amp;gt;&amp;gt; MATCH THE GEOMETRY TYPE
  spatialReference: { wkid: 4326 },
  source: [], // adding an empty feature collection
  renderer: {   // =&amp;gt;&amp;gt;&amp;gt; MATCH THE RENDERER TYPE
    type: "simple",
    symbol: {
      type: "web-style", //  =&amp;gt;&amp;gt;&amp;gt; MATCH THE SYMBOL TYPE
      styleName: "Esri2DPointSymbolsStyle",
      name: "landmark"
    }
  },
  popupTemplate: {
    title: "{Name}"
  }
 });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Then once you have the &lt;STRONG&gt;resultFeatures&lt;/STRONG&gt;, use FeatureLayer.applyEdits to add the features.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const addEdits = {
  addFeatures: graphics
};
layer.applyEdits(addEdits).then(function(results) {
  // feature are added... Now you can query the features
})
.catch(function(error){
 // apply edits error
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;-Undrral&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 16:06:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-scale-marker-size-based-on-zoom/m-p/1048771#M72632</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2021-04-19T16:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to scale marker size based on zoom?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-scale-marker-size-based-on-zoom/m-p/1049667#M72668</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&amp;gt; Is there a way to make Graphics on a GraphicsLayer scale based on zoom? &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;No. There is no way to efficiently scale the symbols of graphics in the view graphics or in a GraphicsLayer.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;gt; If not, how could I modify the viewshed sample to use a FeatureLayer instead?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You will need to create a client-side feature layer and add a simple renderer to it using the code in the sample you referenced above. Undral's comment shows how you can create a feature layer using graphics. If this is only to display temporary results in the view, you can just construct the FeatureLayer and pass the graphics to the layer.source. When you want to clear the graphics, destroy the layer. That way you avoid using applyEdits.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The method of managing the graphics with applyEdits or creating a new layer every time is up to you.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 16:45:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-scale-marker-size-based-on-zoom/m-p/1049667#M72668</guid>
      <dc:creator>KristianEkenes</dc:creator>
      <dc:date>2021-04-21T16:45:33Z</dc:date>
    </item>
  </channel>
</rss>

