[GRASSLIST:9334] How to query a GRASS Vector dataset with UMN Mapserver

Hi List,
I just managed to display my grass vector data with the UMN Mapserver. Fine,
works nice. :slight_smile:
What I did not solve yet: to make it possible to query those vector themes.
Anybody succeeded in this? I really would be happy for some comments/hints.
Kind regards,

Wolfgang

--
Telefonieren Sie schon oder sparen Sie noch?
NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie

Hi Wolfgang,
I'm really interested in display grass data into mapserver....

Do you maybe have a "couple of minute" to submit to the list or to the grass wiki some hints on how to do it?

I think it would be really helpfull for a lot of people...

Thanks
Maxi

Wolfgang Qual wrote:

Hi List,
I just managed to display my grass vector data with the UMN Mapserver. Fine,
works nice. :slight_smile:
What I did not solve yet: to make it possible to query those vector themes.
Anybody succeeded in this? I really would be happy for some comments/hints.
Kind regards,

Wolfgang

--

Eng. Massimiliano Cannata
Scuola Universitaria Professionale della Svizzera Italiana
Istituto Scienze della Terra
Via Trevano, c.p. 72
CH-6952 Canobbio-Lugano
Tel: +41 (0)58 666 62 18
Fax +41 (0)58 666 62 09

Sure. My Mapfile looks like this:
+++++++++++++++
# MAPTITLE "grassdatentest" -*- mode: default-generic; backup-by-copying: t;
-*-
MAP
    STATUS ON
    DEBUG ON
    SIZE 400 300

    SYMBOLSET "/data/mapserver/etc/symbols/symbols-for-ms40.sym"
    FONTSET "/data/mapserver/etc/symbols/fonts/fonts.list"
    UNITS METERS
    IMAGECOLOR 255 255 255

OUTPUTFORMAT
    NAME png
    DRIVER "GD/PNG"
    MIMETYPE "image/png"
    IMAGEMODE PC256
    EXTENSION "png"
    TRANSPARENT ON
END

EXTENT 590000 4914000 609000 4928000
NAME grassdatentest

#
# Start of web interface definition
#
WEB
    TEMPLATE "/data/mapserver/etc/templates/xml.html"
    HEADER "/data/mapserver/etc/templates/xml.html"
    IMAGEPATH "/data/web/tmp/"
    IMAGEURL "/tmp/"
# FOOTER "$installdir/etc/templates/dream_footer.html"
      METADATA
    META_KEYWORDS ""
    EMAIL ""
    MAP_TITLE "Testkarte Grassdaten"
    META_COMMENTS ""
    DEFAULT_LAYERS "l1"
    DEFAULT_EXTENT "590000 4914000 609000 4928000"
    META_DESCRIPTION ""
    COMMENT ""
    AUTHOR ""
    DESCRIPTION ""
  END
END

# Mapserver LEGEND object
LEGEND
    KEYSIZE 22 12
    LABEL
      TYPE TRUETYPE
      FONT arial
      SIZE 8
      COLOR 0 0 0
      WRAP "@"
    END
    STATUS ON
# TRANSPARENT TRUE
END # legend

#
# Mapserver SCALEBAR object
#
SCALEBAR
    STATUS EMBED
    LABEL
      SIZE tiny
      COLOR 0 0 0
      OUTLINECOLOR 255 255 255
    END
    STYLE 0
    INTERVALS 4
    SIZE 280 5
    COLOR 0 0 0
    BACKGROUNDCOLOR 255 255 255
    OUTLINECOLOR 0 0 0
    UNITS KILOMETERS
    POSITION LR
    TRANSPARENT TRUE
END # scalebar

#
# reference map
#
REFERENCE
  IMAGE /data/mapserver/etc/refmaps/spearfish1.gif
  SIZE 76 76
  EXTENT 590000 4914000 609000 4928000
  STATUS ON
  COLOR -1 -1 -1
  OUTLINECOLOR 255 0 0
END

# OGR-Layer aus GRASS
#_# START LAYER l1
LAYER NAME "l1"
TYPE polygon
STATUS ON
    CONNECTIONTYPE OGR
    CONNECTION "/home/wqual/grassdata/spearfish60/grasstest/vector/erde/head"
    DATA "1" # Layer number 1, 0 without attribute data
   METADATA
      LTITLE "l1"
      TABLE_FIELDS "ID,CAT,LABEL"
      "DESCRIPTION" ""
      "RESULT_FIELDS" ""
   END #metadata
   LABELITEM "label"
   SYMBOLSCALE 5000
   LABELMAXSCALE 600000
   TOLERANCE 5
### TYPE Polygon -- LEGTYPE 0x01 -- SYMTYPE 0x02
### singlepolyleg

   CLASSITEM "cat"
   CLASS NAME "soils boundary"
   EXPRESSION ('[label]'='VBF') # only show those entries that match with this
expression
   COLOR -1 -1 -1 # no filling colour
    OUTLINECOLOR 20 200 10
    LABEL
       TYPE truetype
       FONT arial
       OUTLINECOLOR 255 255 255
       POSITION CC
       SIZE 8
       MINSIZE 10
       MAXSIZE 12
       COLOR 180 80 80
     END # end label
   END #CLASS
#_# LAYER l1 QUERY
  HEADER /data/maps/rgu/intern/grassdatentest/l1head.html # does not work yet
  TEMPLATE /data/maps/rgu/intern/grassdatentest/l1-data.html # does not work
yet
  TOLERANCE 5
END # LAYER l1

#_# START LAYER l2
LAYER NAME "l2"
TYPE raster
STATUS ON
   DATA "/home/wqual/grassdata/spearfish60/grasstest/cellhd/hoehe"
   CLASS NAME "hoehe"
   EXPRESSION ([pixel]>= 1066 AND [pixel] < 1259)
    COLOR 172 155 0
   END
[...]
END # LAYER l2
#END # end of mapfile

++++++++++++

Currently, we are working with Mapserver 4.6.2 with ogr-support (but it should
also work with a different version)
Mapserver must be compiled with ogr-support:

wqual@standalone:/data/cgi$ ./mapserv462max -v
MapServer version 4.6.2 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER
SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=THREADS
INPUT=TIFF INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
DEBUG=MSDEBUG

and:
wqual@standalone:/data/cgi$ ogrinfo --formats
Loaded OGR Format Drivers:
  -> "GRASS" (readonly)
[...]

My system is running on Debian Sarge. I had to rebuild the proj-Library to get
this map running (the version that is part of the stable distribution is
missing datum support). Hope that this is a useful hint for you.

Best regards,

Wolfgang

Am Dienstag 06 Dezember 2005 pH:50:14 nachmittags/abends schrieb Massimiliano
Cannata:

Hi Wolfgang,
I'm really interested in display grass data into mapserver....

Do you maybe have a "couple of minute" to submit to the list or to the
grass wiki some hints on how to do it?

I think it would be really helpfull for a lot of people...

Thanks
Maxi

Wolfgang Qual wrote:
>Hi List,
>I just managed to display my grass vector data with the UMN Mapserver.
> Fine, works nice. :slight_smile:
>What I did not solve yet: to make it possible to query those vector
> themes. Anybody succeeded in this? I really would be happy for some
> comments/hints. Kind regards,
>
>Wolfgang