<div dir="ltr"><div dir="ltr">Hi Richard,<div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 10, 2021 at 11:33 AM Richard Duivenvoorde <<a href="mailto:rdmailings@duif.net">rdmailings@duif.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I've been able to create a vector with Temporal Properties and use it in <br>
the Temporal Controller [0]<br>
<br>
Now I try to do the same for a WMS-Time layer...<br>
<br>
The layer "precip-blue-transparent/nearest" (epsg:3857 or 28992)<br>
from this service:<br>
<a href="https://geoservices.knmi.nl/adagucserver?dataset=RADAR&VERSION=1.1.1&request=getcapabilities" rel="noreferrer" target="_blank">https://geoservices.knmi.nl/adagucserver?dataset=RADAR&VERSION=1.1.1&request=getcapabilities</a><br>
(our national Weather institute) loads fine and is usable in the <br>
Temporal Controller (PM5 = 5 min data, nice!)<br>
<br>
Copying the uri from that layer properties and using it in pyqgis just <br>
works:<br>
<br>
uri = <br>
'allowTemporalUpdates=true&contextualWMSLegend=0&crs=EPSG:3857&dpiMode=7&featureCount=10&format=image/png&layers=RAD_NL25_PCP_CM&styles=precip-blue-transparent/nearest&temporalSource=provider&timeDimensionExtent=2021-03-31T09:25:00Z/2021-05-03T12:20:00Z/PT5M&type=wmst&url=<a href="https://geoservices.knmi.nl/adagucserver?dataset%3DRADAR%26VERSION%3D1.1.1%26request%3Dgetcapabilities" rel="noreferrer" target="_blank">https://geoservices.knmi.nl/adagucserver?dataset%3DRADAR%26VERSION%3D1.1.1%26request%3Dgetcapabilities</a>'<br>
<br>
layer = QgsRasterLayer(uri, 'KNMI', "wms")<br>
<br>
QgsProject.instance().addMapLayer(layer, True)<br>
<br>
<br>
If I try to use a 'cleaner' raster layer uri (thinking I could set some <br>
temporal properties on the layer later), I fail to get it 'registered' <br>
on the Temporal Controller OR even severe QGIS crashes (when you only <br>
leave out the <br>
"timeDimensionExtent=2021-03-31T09:25:00Z/2021-05-03T12:20:00Z/PT5M" <br>
part... see [1])<br></blockquote><div>To add a WMST layer via PyQGIS you will need to pass "type" parameter with value "wmst", "temporalSource" parameter and  "timeDimensionExtent" parameter with the temporal extent value  in the layer URI, </div><div>when QGIS find "type=wmst"  in URI, it looks for the  "timeDimensionExtent" parameter value to create the provider temporal capabilities. For your case</div><div> it fails to find the parameter and while parsing the extent it crashes, this is a bug, we need to open an issue and address it.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I thought to use the provider defaults (from WMS capabilities), to be <br>
able to for example change/set the temporal extent later:<br>
layer_temporal_props = layer.temporalProperties( capabilities )<br>
but... I cannot get to the WMS capabilities... (@Matthias: THAT is was <br>
searching in the api :-) )<br></blockquote><div>You can achieve that by using  layer_temporal_props = layer.temporalProperties( ).<span style="color:rgb(0,103,124);font-style:italic;font-weight:600">setDefaultsFromDataProviderTemporalCapabilities</span>(capabilities)</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
This for example:<br>
<br>
uri = <br>
'allowTemporalUpdates=true&temporalSource=provider&crs=EPSG:28992&layers=RAD_NL25_PCP_CM&styles=precip-blue-transparent/nearest&format=image/png&url=<a href="https://geoservices.knmi.nl/adagucserver?dataset=RADAR&VERSION=1.1.1" rel="noreferrer" target="_blank">https://geoservices.knmi.nl/adagucserver?dataset=RADAR&VERSION=1.1.1</a>'<br>
layer = QgsRasterLayer(uri, 'KNMI', "wms")<br>
QgsProject.instance().addMapLayer(layer, True)<br>
<br>
results in a valid WMS, but not Temporal aware layer.<br>
And untill now I fail to 'make it temporal' via QGIS. </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Anybody a hint (or tell me 'NYI' :-( ...)?<br></blockquote><div>Here the "type" parameter with value "wmst" and "timeDimensionExtent" parameter are missing, if you add those the layer will be added and it'll be Temporal aware.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Regards,<br>
<br>
Richard Duivenvoorde<br>
<br>
[0] <br>
<a href="https://github.com/qgis/QGIS-Documentation/blob/1263b663d5160c2a2c0984c16ca7a5ce4bdd182f/docs/pyqgis_developer_cookbook/temporal_data.rst" rel="noreferrer" target="_blank">https://github.com/qgis/QGIS-Documentation/blob/1263b663d5160c2a2c0984c16ca7a5ce4bdd182f/docs/pyqgis_developer_cookbook/temporal_data.rst</a><br>
<br>
[1] uri = <br>
'allowTemporalUpdates=true&temporalSource=provider&type=wmst&layers=RAD_NL25_PCP_CM&styles=precip-blue-transparent/nearest&crs=EPSG:3857&format=image/png&url=<a href="https://geoservices.knmi.nl/adagucserver?dataset%3DRADAR%26VERSION%3D1.1.1%26request%3Dgetcapabilities" rel="noreferrer" target="_blank">https://geoservices.knmi.nl/adagucserver?dataset%3DRADAR%26VERSION%3D1.1.1%26request%3Dgetcapabilities</a>'<br>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><br></div><div><br></div>All the Best,<div><br></div><div>Samweli</div></div></div></div>