<?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 Changing timeslider timestops and layer definitions by user filter in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-timeslider-timestops-and-layer/m-p/351999#M32631</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm looking for an example where layerDefinition can be changed by user.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm showing a map with timeslider and filter next to the map. The map displays regions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There are some filter options, which can be changed, like age and year.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I change the age or year, I want to make the map (including the timeslider) to accept the selected filter option.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a solution, but I want to be sure, that it is the right way how to do it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So...I create ArcGISDynamicMapServiceLayer layer. It contains 7 layers, where each layer contains data for one specific year. Only one layer can be displayed at a time. I set the visible layer: someLayer.setVisibleLayers([array of layers]), set the layerDefinitions (containing some initial filter options) for the visible layer and then add the layers to the map (map.addLayers([array of layers])).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TimeSlider init goes after that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What is the correct way to change the layer definitions when a filter option changes ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I do it like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When the 'Age' filter option changes, I get the selected age and change the layerDefinitions for the visible layer by setting the layerDefinitions like this: someLayer.setLayerDefinitions(layerDefinitions), where layerDefinitions contains the new definition string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When the 'Year' filter option changes, I do the same as when changing the age, but in this case I have to change the visible layer (someLayer.setVisibleLayers([array of layers])) and the timeslider has to be updated too. After setting the changed layerDefinition to the visible layer I finally update timeslider by changing its timestops using the changed TimeExtent (changed year means new timeextent). After that I start the timeslider and everything looks to be ok.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All I ask is: Is this solution OK or is there a better/cleaner solution fos this ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;g&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Apr 2013 08:19:32 GMT</pubDate>
    <dc:creator>ghostbanderas</dc:creator>
    <dc:date>2013-04-15T08:19:32Z</dc:date>
    <item>
      <title>Changing timeslider timestops and layer definitions by user filter</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-timeslider-timestops-and-layer/m-p/351999#M32631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm looking for an example where layerDefinition can be changed by user.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm showing a map with timeslider and filter next to the map. The map displays regions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There are some filter options, which can be changed, like age and year.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I change the age or year, I want to make the map (including the timeslider) to accept the selected filter option.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a solution, but I want to be sure, that it is the right way how to do it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So...I create ArcGISDynamicMapServiceLayer layer. It contains 7 layers, where each layer contains data for one specific year. Only one layer can be displayed at a time. I set the visible layer: someLayer.setVisibleLayers([array of layers]), set the layerDefinitions (containing some initial filter options) for the visible layer and then add the layers to the map (map.addLayers([array of layers])).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TimeSlider init goes after that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What is the correct way to change the layer definitions when a filter option changes ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I do it like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When the 'Age' filter option changes, I get the selected age and change the layerDefinitions for the visible layer by setting the layerDefinitions like this: someLayer.setLayerDefinitions(layerDefinitions), where layerDefinitions contains the new definition string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When the 'Year' filter option changes, I do the same as when changing the age, but in this case I have to change the visible layer (someLayer.setVisibleLayers([array of layers])) and the timeslider has to be updated too. After setting the changed layerDefinition to the visible layer I finally update timeslider by changing its timestops using the changed TimeExtent (changed year means new timeextent). After that I start the timeslider and everything looks to be ok.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All I ask is: Is this solution OK or is there a better/cleaner solution fos this ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;g&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Apr 2013 08:19:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-timeslider-timestops-and-layer/m-p/351999#M32631</guid>
      <dc:creator>ghostbanderas</dc:creator>
      <dc:date>2013-04-15T08:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Changing timeslider timestops and layer definitions by user filter</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-timeslider-timestops-and-layer/m-p/352000#M32632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is the code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Apr 2013 08:51:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-timeslider-timestops-and-layer/m-p/352000#M32632</guid>
      <dc:creator>ghostbanderas</dc:creator>
      <dc:date>2013-04-16T08:51:40Z</dc:date>
    </item>
  </channel>
</rss>

