[mapserver-users] GDAL netcdf/hdf driver and WMS/WCS, file not found (path error)

Maarten Plieger plieger at knmi.nl
Mon May 19 09:07:05 EDT 2008


Hello,
I am using the netcdf and hdf5 drivers from GDAL to output images and 
data to the WMS and WCS services from UMN MapServer. When using an 
absolute path for these kind of files, the files are not found by 
mapserver.
For example a piece of my mapfile:
    NAME "netcdf"
    DATA 'NETCDF:"/nobackup/users/plieger/mapdata/no2_200803.nc":Band1'
MapServer cannot find:
/nobackup/users/plieger/mapdata/NETCDF:"/nobackup/users/plieger/mapdata/no2_200803.nc":Band1
The filename should be
NETCDF:"/nobackup/users/plieger/mapdata/no2_200803.nc":Band1
What is wrong: mapserver puts the path 
"/nobackup/users/plieger/mapdata/" before "NETCDF".

Therefore I changed in mapstring.c at line 415:
[code]
/* Check if path is absolute */
  if((abs_path == NULL) || (abslen == 0) ||
       (path[0] == '\\') || (path[0] == '/') ||
         (pathlen > 1 && (path[1] == ':'))
    )
[/code]

to:

[code]
/* Check if path is absolute */
  if((abs_path == NULL) || (abslen == 0) ||
       (path[0] == '\\') || (path[0] == '/') ||
         (pathlen > 1 && (path[1] == ':'))||
           (strstr(path,":\"")>0)
    )
[/code]
So " || (strstr(path,":\"")>0)" is added.
The code looks at the :" tokens occuring in the filename, when these 
tokens occur the path should not be added to the filename.
(This is because NETCDF: should be at the start of the filename, so that 
GDAL knows which driver to choose)
It is a solution for me for now, but i think that there is a better way 
to solve it, without using "ststr".

Best Regards,
Maarten Plieger

-- 
Maarten Plieger
KNMI, R&D Information and Observation Technology, De Bilt
(t) +31 30 2206330 



More information about the mapserver-users mailing list