<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="margin:0px;font-size:12pt">Hi All,</span>
<div style="margin:0px;font-size:12pt"><br>
I'm trying to get a very specific configuration working in my mapfile.<br>
<br>
I have geotiff files in a directory structure that looks like:<br>
http://example.org/v1/AUTH_xyz/my-dataset/YYYY/YYYY_MM_DD/product_name_YYYY_MM_DD.vrt<br>
Where YYYY is a year (eg 2018) and YYYY_MM_DD is a date (eg 2018_08_01)<br>
<br>
EG:</div>
<div style="margin:0px;font-size:12pt">DATA "/vsicurl/<span style="margin:0px;background-color:rgb(255, 255, 255);display:inline !important">http://example.org/v1/AUTH_xyz/my-dataset/2018/2018_08_01/product_name_2018_08_01.vrt"</span><br>
<br>
I'm trying to get this working with a dynamic mapfile, with runtime substitution, and ideally, I'd also like it to work with WMS Time queries.<br>
<br>
I've found that the WMS TIME query parameter doesn't automatically work with runtime substitution. It can be used as an attribute<span> </span><span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace">[TIME] </span>in a FILTER, or in an EXPRESSION,
but nowhere else.<br>
To work around that, I've set up a Runtime Substitution variable also named time:<br>
<br>
<span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace">VALIDATION</span>
<div style="margin:0px"><span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace"> "time" "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"</span></div>
<span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace">END</span><br>
</div>
<div style="margin:0px;font-size:12pt"><br>
</div>
<div style="margin:0px;font-size:12pt">That works, it captures the right variable and allows me to use the WMS-provided TIME param in the DATA directive like:<br>
<span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace;background-color:rgb(255, 255, 255);display:inline !important">LAYER </span></div>
<div style="margin:0px;font-size:12pt"><span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace;background-color:rgb(255, 255, 255);display:inline !important"> DATA "/vsicurl/</span><span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace;background-color:rgb(255, 255, 255);display:inline !important">http://example.org/v1/AUTH_xyz/my-dataset/2018/%time%/product_name_%time%.vrt"</span><span style="margin:0px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span><br>
But that doesn't quite match the naming scheme of the dataset.<br>
In order for this to work properly, I need to be able to extract the<span> </span><i>year</i>,<i><span> </span>month</i> and<span> </span><i>day<span> </span></i>portions of the datestring, and use them individually.<br>
Like:<br>
<span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace;background-color:rgb(255, 255, 255);display:inline !important">DATA "/vsicurl/</span><span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace;background-color:rgb(255, 255, 255);display:inline !important">http://example.org/v1/AUTH_xyz/my-dataset/%year%/%year%_</span><span style="margin:0px;background-color:rgb(255, 255, 255);display:inline !important"><span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace;background-color:rgb(255, 255, 255);display:inline !important">%month%_</span><span style="margin:0px;background-color:rgb(255, 255, 255);display:inline !important"><span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace;background-color:rgb(255, 255, 255);display:inline !important">%day%</span></span></span><span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace;background-color:rgb(255, 255, 255);display:inline !important">/product_name_</span><span style="margin:0px;background-color:rgb(255, 255, 255);display:inline !important"><span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace;background-color:rgb(255, 255, 255);display:inline !important">%year%_</span><span style="margin:0px;background-color:rgb(255, 255, 255);display:inline !important"><span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace;background-color:rgb(255, 255, 255);display:inline !important">%month%_</span><span style="margin:0px;background-color:rgb(255, 255, 255);display:inline !important"><span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace;background-color:rgb(255, 255, 255);display:inline !important">%day%</span></span></span></span><span style="margin:0px;font-size:11pt;font-family:"Courier New", monospace;background-color:rgb(255, 255, 255);display:inline !important">.vrt"</span><span style="margin:0px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span><br>
I've read the documentation around WMS_Time and Runtime Substitution, but I can't quite work out if this is even possible.<br>
Note, I understand I could probably do this at the apache level, by transforming the query with a rewrite eg:<br>
"&TIME=2018-08-01" -> "<span style="margin:0px;background-color:rgb(255, 255, 255);display:inline !important">&TIME=2018-08-01&YEAR=2018&MONTH=08&DAY=01"<br>
But I'd prefer to do it at the Mapfile level.<br>
<br>
- Ashley Sommer</span></div>
<br>
</div>
</body>
</html>