[MapServer-users] Handeling gdal driver via tileitem for raster
Trygve Aspenes
trygve at aspenes.priv.no
Thu Sep 21 06:51:46 PDT 2023
Hi
I have a postgis db with netcdf filenames and the rest of the needed
columns.
So I have a layer, time_idx, to get the geom.
And the raster layer with tileitem and tileindex like this:
LAYER
NAME "layername"
STATUS ON
TYPE raster
PROCESSING "BANDS=1"
TILEITEM "filename"
TILEINDEX "time_idx"
END
The problem is the filename is handled as a full path to a filename. But
since this is a netcdf I need something like this
(See eg https://gdal.org/drivers/raster/netcdf.html#raster-netcdf)
gdalinfo NETCDF:"sst.nc":tos
Where NETCDF is the drive
sst.nc is the filename
tos is the variable name in the file.
Is there a way to prepend the driver and append the variable name to the
tileitem? Using DATA directly works.
img2map give me like this:
msPostGISLayerWhichShapes query status: PGRES_TUPLES_OK (2)
msPostGISLayerWhichShapes got 1 records in result.
msPostGISLayerNextShape called.
msPostGISReadShape called.
msPostGISReadShape: PQgetlength = 86
msPostGISReadShape: [filename] "netcdf-filename.nc"
msPostGISReadShape: Setting shape->index = 5
msPostGISReadShape: Setting shape->resultindex = 0
msPostGISReadShape: [index] 5
msPostGISReadShape: [shape] POLYGON ((-2717181.7304994701407850
-5571048.1403121398761868, -2717181.7304994701407850
-1475048.1403121401090175, 1378818.2695005300920457
-1475048.1403121401090175, 1378818.2695005300920457
-5571048.1403121398761868, -2717181.7304994701407850
-5571048.1403121398761868))
msDrawRasterLayerLow(layer-name): Filename is: netcdf-filename.nc
msDrawRasterLayerLow(layer-name): Path is: netcdf-filename.nc
GDAL_netCDF: driver detected file type=3, libnetcdf detected type=3
GDAL_netCDF: var_count = 242
GDAL_netCDF: variable #26 [longitude] was ignored
GDAL_netCDF: variable #27 [latitude] was ignored
GDAL: GDALOpen(netcdf-filename.nc, this=0x56413c343280) succeeds as
netCDF.
msResampleGDALToMap in effect: cellsize = 1.000000
msDrawGDAL(layer-name): using RAW_WINDOW=0 0 512 512, dst=0,0,512,512
msGetGDALBandList(): Image handling error. Attempt to operate on GDAL
file with no bands, layer=layer-name.
GDAL: GDALClose(netcdf-filename.nc, this=0x56413c343280)
msPostGISLayerFreeItemInfo called.
msPostGISLayerClose called: geom from (select * from netcdf_data where
product_variable='') as foo using unique id
msConnPoolRelease(time_idx,host=10.88.0.3 user=postgres dbname=postgres
port=5432
password=*********************************msConnPoolClose(host=10.88.0.3
user=postgres dbname=postgres port=5432
password=*********************************msDrawMap(): Image handling
error. Failed to draw layer named 'layer-name'.
msDrawMap(): Image handling error. Failed to draw layer named
'layer-name'. <br>
msGetGDALBandList(): Image handling error. Attempt to operate on GDAL
file with no bands, layer=layer-name. <br>
msFreeMap(): freeing map at 0x56413bee40a0.
freeLayer(): freeing layer at 0x56413bf67950.
msPostGISLayerIsOpen called.
freeLayer(): freeing layer at 0x56413bf68e50.
GDAL: In GDALDestroy - unloading GDAL shared library.
At least it detects the driver I think, but I still need to specify the
variable.
Any ideas are appreciated or if you can point me to the part of the code
that handles this.
Thanks!
Trygve Aspenes
More information about the MapServer-users
mailing list