[mapserver-users] msDrawRasterLayerLow(): Unable to access file.
Matt Bartolome
mattxbart at gmail.com
Thu Jan 17 13:30:38 PST 2013
I've run into a strange problem and can't locate the source of the issue.
I'm running a python/mapscript function with apache2 and django via wsgi on
Ubuntu 12.04, mapserver 6.2. When I run the script using plain python as
the www-data user (the same user as the wsgi daemon) the script works
perfectly fine. When I run it under the wsgi process (through the browser)
it fails with the error:
msDrawMap(): Image handling error. Failed to draw layer named 'imagery_2010'.
msDrawRasterLayerLow(): Unable to access file. Corrupt, empty or
missing file '/mnt/test/imagery/test.ecw' for layer 'imagery_2010'.
At first I thought it was a simple permissions issue (reading the ecw off a
mount point etc). I verified with inotifywait that the file is being opened
by the wsgi script. I have compiled gdal with ECW support and have checked
that the wsgi process is running off the same mapscript python lib. Also,
the same wsgi script will run without error if I change the raster to a
non-ecw file, so it seems that it just doesn't like the ecw under wsgi.
gdalinfo reads the ecw just fine as well. It is only under the wsgi process
where it has problems. I'm stumped... Thanks for your help!
Here is my map file:
MAP
CONFIG "MS_ERRORFILE" "/tmp/ms_output.txt"
DEBUG 5
CONFIG "PROJ_LIB" "/usr/share/proj/"
PROJECTION
"init=epsg:900913"
END
FONTSET "/test/fontset.txt"
WEB
METADATA
"wms_title" "WMS"
"wms_onlineresource" "
http://localhost:81/cgi-bin/mapserv?map=/test/mapserver-config/plan.map"
"ows_enable_request" "*"
"wms_srs" "epsg:900913"
END
END
OUTPUTFORMAT
NAME png
DRIVER "AGG/PNG"
MIMETYPE "image/png"
IMAGEMODE RGB
EXTENSION "png"
END
LAYER
NAME "imagery_2010"
TYPE RASTER
STATUS ON
DATA "/mnt/test/imagery/test.ecw"
PROJECTION
"init=epsg:2230"
END
PROCESSING "NODATA=255"
PROCESSING "RESAMPLE=AVERAGE"
END
END
Here is the python script:
import mapscript
extent = [-13037387.706571, 3898141.5912883, -13036963.719929,
3898380.4570017]
filename = '/tmp/test.pdf'
raster = '/tmp/test.png'
mapfile = '/test/mapserver-config/plan.map'
map_obj = mapscript.mapObj(mapfile)
map_obj.width = 800
map_obj.height = 600
map_obj.extent = mapscript.rectObj(*extent)
image = map_obj.draw()
image.save(raster)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20130117/4388c759/attachment.htm>
More information about the MapServer-users
mailing list