[GRASS-user] Reading grass vector files with mapserver

Francisco Alonso Sarría alonsarp at um.es
Sat Oct 14 22:05:20 EDT 2006


Hi:

I want to include some GRASS vector maps into a mapserver file map.

As an example:


LAYER
  NAME municipios
  TYPE POLYGON
  STATUS ON
  CONNECTIONTYPE OGR
  CONNECTION /data/grassdata/atlas/alonso/vector/municipios/head
  TOLERANCE 5
  DATA "1"
  DUMP TRUE

  CLASS
    NAME "5"
    EXPRESSION ( [cod_comarc] = 5 ) 
    COLOR 245 245 0
    OUTLINECOLOR 0 0 0
    LABEL 
      #TYPE truetype
      # FONT arial
      POSITION CC
      SIZE SMALL
      COLOR 0 0 225
    END
  END

Classifying the polygons according to the column "cod_comarc" in the
database. 

The problem is that I can not access that database (if I change to:

EXPRESSION ( [cat] = 5 )

works fine). 


Browsing messages in the Internet I have found that it is related with
the need of passing the GISBASE environmental variable. As a matter of
fact if I try:

$ ogrinfo -ro /data/grassdata/atlas/alonso/vector/municipios/head
Warning 1: GRASS warning: GISBASE enviroment variable was not set,
using:
/usr/local/grass-6.3.cvs
INFO: Open of `/data/grassdata/atlas/alonso/vector/municipios/head'
using driver `GRASS' successful.
1: 0
2: 1

I obtain an error that looks similar, but if I do:

export GISBASE=/usr/local/grass-6.3.cvs;ogrinfo
-ro /data/grassdata/atlas/alonso/vector/municipios/head
INFO: Open of `/data/grassdata/atlas/alonso/vector/municipios/head'
using driver `GRASS' successful.
1: 0
2: 1

Everything works fine.

So the question is how to pass GISBASE to mapserv and to PHPmapscript
scripts. I have tried adding:

SetEnv GISBASE /usr/local/grass-6.3.cvs

to the http.conf and it doesn't work 


Any suggestion?

Thanks in advance.

Paco


-- 
Francisco Alonso Sarría
Departamento de Geografía. 
Univ. de Murcia E-30001-Murcia
+34 968364357
http://www.um.es/geograf/sigmur




More information about the grass-user mailing list