Problems displaying GRASS raster layers

Sean Gillies sgillies at FRII.COM
Wed Dec 15 11:02:49 EST 2004


On Dec 15, 2004, at 8:50 AM, William Hudspeth wrote:

> Hello All,
>
> I am having problems getting GRASS raster layers to display. I am using
> the Python mapscript module. When I try to display a GRASS layer, I get
> the following error:
>
> .....
> [Tue Dec 14 15:37:37 2004] [error] [client 10.16.1.109]
> phairmap.draw_map()!!!!#build the map image and store in /tmp
> [Tue Dec 14 15:37:37 2004] [error] [client 10.16.1.109]   File
> "/var/www/cgi-bin/reason/mapmodule.py", line 61, in draw_map
> [Tue Dec 14 15:37:37 2004] [error] [client 10.16.1.109]
> self.map_image=self.nmMap.draw()
> [Tue Dec 14 15:37:37 2004] [error] [client 10.16.1.109]   File
> "/usr/local/lib/python2.3/site-packages/mapscript.py", line 1759, in
> draw
> [Tue Dec 14 15:37:37 2004] [error] [client 10.16.1.109]     def draw
> (*args): return _mapscript.mapObj_draw(*args)
> [Tue Dec 14 15:37:37 2004] [error] [client 10.16.1.109] IOError:
> msDrawRaster(): Unable to access file.
> (/home/bhudspeth/grass_data/western_us/mod08_ozone/cellhd/dem_scale)
>
> My Mapfile entry looks like this:
>
> LAYER
>  NAME "DEM"
>  TYPE RASTER
>  STATUS ON
>  DATA
> /home/bhudspeth/grass_data/western_us/mod08_ozone/cellhd/dem_scale
> END
>
> My machine setup is as follows:
>
> 1. Red Hat Fedora Core 3
> 2. Mapserver Version 4.2.1
> 3. GDAL version  1.1.9.0  - GRASS database rasters ARE enabled (i.e.,
> GRASS: GRASS Database Rasters)
> 4. Running GRASS 5.3
>
> Having read various mailing list postings and relevant text in "Open
> Source GIS: A GRASS GIS Approach", I have made sure that the following
> steps have also been taken:
> 1. I have placed a copy of the .grassrc53 file in $DocumentRoot as
> specified in httpd.conf file (/var/www/html2)
> 2. GRASS LOCATION group and owner is set to Apache (the book cited
> above
> indicates that the GRASS LOCATION data for UNM/Mapserver have to be
> stored with the same user-ID as the Web Server is running)
>
> I would very much appreciate any help on addressing this error. Thanks,
> Bill Hudspeth
>
>

Bill,

Python makes it easy to diagnose problems.  Start up the interpreter
as a user with the same permissions as Apache, import mapscript,
load the mapfile and see if you can directly access the GRASS file:

Python 2.3 (#1, Sep 13 2003, 00:49:11)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import mapscript
 >>> mo = mapscript.mapObj('...')
 >>> lo = mo.getLayerByName('DEM')
 >>> f = open(lo.data, 'r')

If your data isn't available, this will raise an exception.

cheers,
Sean



More information about the mapserver-users mailing list