<?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: Updating WMTS TIME or other parameters using TimeSlider in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-wmts-time-or-other-parameters-using/m-p/1399887#M84107</link>
    <description>&lt;P&gt;Get the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider.html" target="_self"&gt;TimeSlider&lt;/A&gt; date.&amp;nbsp; The &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider.html#timeExtent" target="_self"&gt;timeExtent&lt;/A&gt; value you choose depends on the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider.html#mode" target="_self"&gt;mode&lt;/A&gt;.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var timeSliderDate = timeSlider.timeExtent.endDate || timeSlider.timeExtent.startDate;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Clone the date and zero out the time components:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var baseDate = new Date(timeSliderDate.valueOf());
baseDate.setUTCMilliseconds(0);
baseDate.setUTCSeconds(0);
baseDate.setUTCMinutes(0);
baseDate.setUTCHours(0);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Get the number of hours between the two date objects:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var milliseconds = timeSliderDate.valueOf() - baseDate.valueOf();
var seconds = milliseconds / 1000;
var minutes = seconds / 60;
var hours = minutes / 60;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Set the layer's request parameters:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;UM1_CLOUD_WMTSLayer.set("customLayerParameters.TIME", baseDate.toISOString());
UM1_CLOUD_WMTSLayer.set("customLayerParameters.DIM_FORECAST", Math.round(hours));&lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 23 Mar 2024 00:35:59 GMT</pubDate>
    <dc:creator>JoelBennett</dc:creator>
    <dc:date>2024-03-23T00:35:59Z</dc:date>
    <item>
      <title>Updating WMTS TIME or other parameters using TimeSlider</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-wmts-time-or-other-parameters-using/m-p/1399557#M84105</link>
      <description>&lt;P&gt;I have&amp;nbsp; WMTS layer with the&amp;nbsp; TIME dimension indicating "base time" from which a forecast is computed and a custom DIM_FORECAST parameter indicating forecast horizons (times for which forecasts are generated) in hours (0-72) from the "base" TIME value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I add the layer like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;  const UM1_CLOUD_WMTSLayer = new WMTSLayer({
        url: "https://mapy.meteo.pl/geoserver/gwc/service/wmts?",
        activeLayer: {
          id: "um:UM1_CLOUD",
        },
        customLayerParameters: {
          VERSION: '1.1.1',
          FORMAT: 'image/png',
          TIME: '2024-03-19T00:00:00Z',          
          DIM_FORECAST: 7,         
          TRANSPARENT: true,
          SRS: 'EPSG:3857'
        }
      });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;now I would like to controll the DIM_FORECAST parameter with the TimeSlider widget.&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider.html" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider.html&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;I need to translate the date and time set in TimeSlider widget to the correct value of the DIM_FORECAST and call the WMTS with that value of the parameter.&lt;BR /&gt;&lt;BR /&gt;How can I just get the set date from the TimeSlider (as UTC timestamp for example) and work with that value later on to translate it to DIM_FORECAST and call the WMTS.&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 22 Mar 2024 11:08:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-wmts-time-or-other-parameters-using/m-p/1399557#M84105</guid>
      <dc:creator>JurajMurcko1</dc:creator>
      <dc:date>2024-03-22T11:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Updating WMTS TIME or other parameters using TimeSlider</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-wmts-time-or-other-parameters-using/m-p/1399887#M84107</link>
      <description>&lt;P&gt;Get the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider.html" target="_self"&gt;TimeSlider&lt;/A&gt; date.&amp;nbsp; The &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider.html#timeExtent" target="_self"&gt;timeExtent&lt;/A&gt; value you choose depends on the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider.html#mode" target="_self"&gt;mode&lt;/A&gt;.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var timeSliderDate = timeSlider.timeExtent.endDate || timeSlider.timeExtent.startDate;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Clone the date and zero out the time components:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var baseDate = new Date(timeSliderDate.valueOf());
baseDate.setUTCMilliseconds(0);
baseDate.setUTCSeconds(0);
baseDate.setUTCMinutes(0);
baseDate.setUTCHours(0);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Get the number of hours between the two date objects:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var milliseconds = timeSliderDate.valueOf() - baseDate.valueOf();
var seconds = milliseconds / 1000;
var minutes = seconds / 60;
var hours = minutes / 60;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Set the layer's request parameters:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;UM1_CLOUD_WMTSLayer.set("customLayerParameters.TIME", baseDate.toISOString());
UM1_CLOUD_WMTSLayer.set("customLayerParameters.DIM_FORECAST", Math.round(hours));&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 23 Mar 2024 00:35:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-wmts-time-or-other-parameters-using/m-p/1399887#M84107</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2024-03-23T00:35:59Z</dc:date>
    </item>
  </channel>
</rss>

