UNOFFICIAL
Hi Trygve,
One solution we use is:
1. individual vrt files for each timestep with the source band. See below
snippet for band 4
<SimpleSource>
<SourceFilename relativeToVRT="1">NETCDF:
SigWaveHgt_SFC.nc:SigWaveHgt_SFC</SourceFilename>
<SourceBand>4</SourceBand>
<SourceProperties RasterXSize="723" RasterYSize="735" DataType="Float32"
BlockXSize="723" BlockYSize="1" />
<SrcRect xOff="0" yOff="0" xSize="723" ySize="735" />
<DstRect xOff="0" yOff="0" xSize="723" ySize="735" />
</SimpleSource>
2. Have an index table in Postgres with the location of the vrt files, band,
time and geom (NB band column is not required, but could be used for another
dimension eg &BAND=4)
location | band | valid_time | geom
/data/SigWaveHgt_SFC_004.vrt | 4 | 2025-02-24 03:00:00 | POLYGON
3. A MapServer INCLUDE file with the available times in the map file
"wms_timeextent"
"2025-02-23T18:00:00Z,2025-02-23T21:00:00Z,2025-02-24T00:00:00Z,2025-02-24T03:00:00Z,2025-02-24T06:00:00Z,2025-02-24T09:00:00Z,2025-02-24T12:00:00Z,2025-02-24T15:00:00Z,2025-02-24T18:00:00Z,2025-02-24T21:00:00Z,2025-02-25T00:00:00Z,2025-02-25T03:00:00Z,2025-02-25T06:00:00Z,2025-02-25T09:00:00Z,2025-02-25T12:00:00Z,2025-02-25T15:00:00Z,2025-02-25T18:00:00Z"
"wms_timedefault" "2025-02-24T03:00:00Z"
4. Configure MapServe with an index layer connecting to the database index
table and a layer with WMS_TIMEITEM "valid_time" and the INCLUDE for the times.
See https://mapserver.org/ogc/wms_time.html
When WMS &TIME request is made, it finds the correct band in the netcdf to
display eg &TIME=2025-02-24T03:00:00Z will display band 4.
Regards,
Kathleen
UNOFFICIAL
-----Original Message-----
From: MapServer-users <[email protected]> On Behalf Of
Seth G via MapServer-users
Sent: Saturday, 22 February 2025 6:46 AM
To: Trygve Aspenes <[email protected]>; MapServer Users
<[email protected]>
Subject: Re: [MapServer-users] Is it possible to pass an attribute to
PROCESSING directive?
Hi Trygve,
It might not be what you need but LAYER PROCESSING allows for run-time
substitution: https://mapserver.org/cgi/runsub.html#parameters-supported
So you could control it from a URL/client-application, but obviously this
wouldn't be getting values from the database.
Seth
--
web:https://geographika.net/ & https://mapserverstudio.net/
mastodon: @[email protected]
On Thu, Feb 20, 2025, at 5:57 PM, Trygve Aspenes via MapServer-users wrote:
> Hi
>
> I have a netcdf file with time dimension. This time dimension is
> expressed as bands in the to mapserver from gdal. So to get the first
> time step you would set
>
> PROCESSING "BANDS=1" for the first timestep PROCESSING "BANDS=2" for
> the second timestep etc.
>
> However my client is passing the time variable as a ISO8601 in the
> request so I can not use run-time substitution as I can not find a way
> to translate a ISO8601 time to the BANDS processing(I have not looked
> into doing some rewrite)
>
> I was thinking of using a postgis where I could preset a time stamp to
> the correct BANDS.
>
> I would the set in the mapfile:
>
> PROCESSING "[bands]"
>
> where bands attribute comes from the select to a postgis, like
>
> select bands from table where time="some iso8601" etc
>
> But this does not work, and the documentation does not say it would
> work
> https://maps/
> erver.org%2Fmapfile%2Flayer.html&data=05%7C02%7CKathleen.Hirst%40bom.g
> ov.au%7C21d2d4514c6240d4db6608dd52b07507%7Cd1ad7db597dd4f2b816e50d663b
> 7bb94%7C0%7C0%7C638757640037766784%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1
> hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUI
> joyfQ%3D%3D%7C0%7C%7C%7C&sdata=QhPkdwuha%2FpTeqOlizYw%2BmVeHdhOXyfLgdA
> 7zGCo3WY%3D&reserved=0 PROCESSING
>
> Any ideas how I could make this work?
>
> Trygve
> _______________________________________________
> MapServer-users mailing list
> [email protected]
> https://list/
> s.osgeo.org%2Fmailman%2Flistinfo%2Fmapserver-users&data=05%7C02%7CKath
> leen.Hirst%40bom.gov.au%7C21d2d4514c6240d4db6608dd52b07507%7Cd1ad7db59
> 7dd4f2b816e50d663b7bb94%7C0%7C0%7C638757640037777955%7CUnknown%7CTWFpb
> GZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkF
> OIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=pRT%2FzsLtoqCaT4YckR2
> LaRv7BBFFboffnqeU2LCO9BY%3D&reserved=0
_______________________________________________
MapServer-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
MapServer-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users