[mapserver-users] Help debugging PostGIS raster connection

Thomas Horner haevitetty at gmail.com
Mon Mar 4 10:38:52 PST 2019


I have a PostGIS connection string that works fine in GDAL, as I get a
raster response when running
---
gdalinfo "PG:host=... port=5432 user='...' password='...'
dbname='weather_models' schema='rasters' table='wpc_snow_50pct_1551268800'
column='rast' mode=1 where='timestamp=\'2019-03-02 00:00:00\''"
---

On this very same server, I have cgi-mapserver running, and the output from
/usr/lib/cgi-bin/mapserv/ -v is
---
MapServer version 7.2.1 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ
SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS
SUPPORTS=RSVG SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER
SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT
SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS
SUPPORTS=GEOS SUPPORTS=PBF INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL
INPUT=SHAPEFILE
---

The problem is, when I use that same PG:... connection string as the DATA
for a LAYER in MapServer, I get an unhelpful error:  Unable to access file.
Corrupt, empty or missing file '<snip of PG connection string>' Couldn't
establish a database connection.

Despite turning DEBUG level to 5, and CPL_DEBUG to ON in the MAP block of
my mapfile, I don't get any helpful debug information whatsoever in my
error log -- just the connection string and "Couldn't establish a database
connection." I have tried a variety of where clauses and other tables and
get the same result. I have no idea if the actual error is coming from GDAL
or MapServer, despite all those strings working fine when running them
directly via GDAL.

By the way, it's the same error whether I use 'timestamp'= or timestamp=.

Here is the mapfile:
---
MAP
 CONFIG "MS_ERRORFILE" "/map/error.txt"
 CONFIG "CPL_DEBUG" "ON"
 DEBUG 5
 PROJECTION
  "init=epsg:4326"
 END
 LAYER
  NAME wpc_snow_50pct
  TYPE RASTER
  STATUS ON
  VALIDATION
   "timestamp" ".*"
  END
  PROJECTION
   "init=epsg:4326"
  END
  METADATA
   "wms_title" "wpc_snow_50pct"
   "wms_srs"   "EPSG:4326"
   "wms_extent" "-108.5 41 -104.5 36"
   "wms_enable_request" "*"
  END
  DATA "PG:host=... port=5432 dbname='weather_models' user='...'
password='...' schema='rasters' table='wpc_snow_50pct_1551268800'
column='rast' mode=1 where='timestamp=\'2019-03-02 00:00:00\''"
  PROCESSING "BANDS=1"
 END
END
---

Any help is appreciated!

Thanks,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20190304/9050e469/attachment.htm>


More information about the MapServer-users mailing list