map files

Jason Maestri sl57k at cc.usu.edu
Thu Feb 17 17:19:41 PST 2000


Rob,
    Using gif files as icons  for point layers is very simple.  I will go over
it in a little detail, because there are some concerns which, if you know about
them upfront, will make things a lot easier.  For this reason, I am also posting
this back up to the mapserver-users list so that it'll be in the archive...

Okay, so here goes:

    1.)  The marker.sym file:
            o Entires must be in the form:
                Symbol
                    Type PIXMAP
                    Image /var/www/eastCanyon_data/icons/camera.gif
                END
             (Notice that quotation marks are not nesecary for the path.)

           o The path of your icons does _not_ need to be below the www root, as
it is
                here, but you may choose to put it there...
    2.) GIF files (like the one that mapserver creates) have only 256 palette
entries.
            o This means that there can only be 256 discrete colors in your gif
file.  Any
                colors used exclusively in your marker gif should be kept to a
minimum, as
                those colors have a low priority when generating the final
image, and may not
                come out looking the way you had planned.  (Correct me if I am
wrong,
                Steve, but if there aren't enough colors left in the palette,
mapserver will
                use the closest ones already existing in the palette to draw
your marker
                image, which in some cases, is not very close...).

    3.) Mapserver allows for transparencies in marker images.  We had to do 2
things to
        flag a color transparent in our gifs.  (Probably didn't need to be this
dificult, but I
        guess it doesn't hurt to be thorough):
            o Choose a color from the palette that is not used.  Make this color
the first
                entry in the palette.  (This will become the color that will be
transparent.)
            o When saving your image (or at other appropriate time) flag that
color as the
                transparent one.  Our software, when doing this, would flag our
image as a
                GIF-89 (or whatever the designation for a transparent gif is),
but not move the
                appropriate color to the 1st place in the palette.  That is why
we were doing it
                manualy in the previous step.

    4.) Remember: Keep your colors to a minumum!

    5.) Sit back, and pray that it worked, the first time.


Well, there you have it.  My dissertation on using gifs as point markers in a
map file.  I hope this doesn't confuse or overwhelm you (or bore you :-)  ) more
than it helps you, these are just some things that took some playing with at
first, so I thought I'd pass them on to you.  Hope it helps!


Good luck,
    Jason

"Ellis Robin (Bundaberg)" wrote:

> Thanks Jason. I worked out my line problems yesterday. I'd be keen to see
> the process of using GIFs as symbols for your point layers. I do recall an
> email about once previously, but perhaps your guidance and/or examples would
> be more helpful.
>
> Rob.
>
> > ----------
> > From:         Jason Maestri[SMTP:sl57k at cc.usu.edu]
> > Sent:         Friday, 18 February 2000 7:39
> > To:   Ellis Robin (Bundaberg)
> > Subject:      Re: map files
> >
> >
> > Ellis,
> >     Yes, you do have to edit your .sym files.  I can send ours to you as
> > well if
> > you'd like them... They are pretty straightforward, however.
> >
> > --Jason
> >
> > "Ellis Robin (Bundaberg)" wrote:
> >
> > > Thanks. I assume that you then have to alter your line.sym and
> > marker.sym
> > > files?
> > >
> > > > ----------
> > > > From:         Jason Maestri[SMTP:sl57k at cc.usu.edu]
> > > > Sent:         Thursday, 17 February 2000 10:46
> > > > To:   Ellis Robin (Bundaberg)
> > > > Subject:      Re: map files
> > > >
> > > > Ellis,
> > > >     Okay, here is a copy of our mapfile.  It contains a couple of
> > examples
> > > > of
> > > > different layers and symbols.  The url to the map is:
> > > >
> > http://lhotse.cee.usu.edu/cgi-bin/mapserv?map=%2Fvar%2Fwww%2FeastCanyon%2F
> > > >
> > eastCanyon.map&layer=states&layer=counties&layer=wsboundary&layer=relief&l
> > > > ayer=streams&layer=pointsources&layer=photos&zoomsize=2&zoomdir=0
> > > >
> > > >
> > > >
> > > > Good luck...
> > > >
> > > > --Jason Maestri
> > > >
> > > >
> > > >
> > > >
> > > > #
> > > > #
> > > > # Start of map file
> > > > #
> > > > #
> > > > NAME DEMO
> > > > STATUS ON
> > > > SIZE 400 400
> > > > SHADESET symbols/shade.sym
> > > > MARKERSET symbols/marker.sym
> > > > LINESET symbols/line.sym
> > > > #EXTENT -508446.377270 4402355.715299 840927.894068 5751729.986637
> > > > #EXTENT 363212.232272 4429247.460481 531884.016189 4597919.244398
> > > > EXTENT 428353.254082 4494335.640256 470521.200062 4536503.586232
> > > > UNITS METERS
> > > > SHAPEPATH "/var/www/eastCanyon_data"
> > > > IMAGECOLOR 255 255 255
> > > >
> > > > #LABELOVERLAP FALSE
> > > >
> > > > #
> > > > # Start of web interface definition
> > > > #
> > > > WEB
> > > >   HEADER eastCanyon_header.html
> > > >   TEMPLATE eastCanyon.html
> > > >   MINSCALE 10
> > > >   MAXSCALE 25500000
> > > > #  log /tmp/eastCanyon.log
> > > >
> > > > END
> > > >
> > > > #
> > > > # Start of reference map
> > > > #
> > > > REFERENCE
> > > >   IMAGE graphics/reference_base.gif
> > > >   EXTENT 377686.0 4492844.0 463131 4536363
> > > >   STATUS ON
> > > >   COLOR -1 -1 -1
> > > >   OUTLINECOLOR 255 0 0
> > > > END
> > > >
> > > > #
> > > > # Start of legend
> > > > #
> > > > LEGEND
> > > >   KEYSIZE 18 12
> > > >   LABEL
> > > >     TYPE BITMAP
> > > >     SIZE MEDIUM
> > > >     COLOR 0 0 89
> > > >   END
> > > >   STATUS ON
> > > > END
> > > >
> > > > #
> > > > # Start of scalebar
> > > > #
> > > > SCALEBAR
> > > >   IMAGECOLOR 255 255 255
> > > >   LABEL
> > > >     COLOR 0 0 0
> > > >     SIZE SMALL
> > > >   END
> > > >   SIZE 350 5
> > > >   COLOR 255 255 255
> > > >   BACKGROUNDCOLOR 0 0 0
> > > >   OUTLINECOLOR 0 0 0
> > > >   UNITS MILES
> > > >   INTERVALS 5
> > > >   STATUS ON
> > > > END
> > > >
> > > > #
> > > > # Start of layer definitions
> > > > #
> > > >
> > > > LAYER
> > > >   NAME states
> > > >   TYPE POLYGON
> > > >   STATUS DEFAULT
> > > >   DATA states/states
> > > >   CLASS
> > > >     NAME "States"
> > > >     SYMBOL 0
> > > >     OUTLINECOLOR 0 0 0
> > > >     COLOR 255 255 204
> > > >     #
> > > >     #Use 107 99 123 for the basin boundary
> > > >     #
> > > >   END
> > > > END
> > > >
> > > > LAYER
> > > >   NAME wsboundary
> > > >   TYPE POLYGON
> > > >   STATUS DEFAULT
> > > >   DATA wsboundary/basin
> > > >   CLASS
> > > >     NAME "Watershed Boundary"
> > > >     SYMBOL 0
> > > >     #COLOR -1 -1 -1
> > > >     OUTLINECOLOR 107 99 123
> > > >     COLOR 214 214 231
> > > >     #COLOR 207 199 223
> > > >   END
> > > > END
> > > >
> > > > LAYER
> > > >   NAME landusegif
> > > >   TYPE RASTER
> > > >   STATUS ON
> > > >   DATA landuse/landuse.gif
> > > >   OFFSITE 0
> > > > END
> > > >
> > > > LAYER
> > > >   NAME relief
> > > >   TYPE RASTER
> > > >   STATUS ON
> > > >   DATA relief/basin.gif
> > > >   OFFSITE 0
> > > > END
> > > >
> > > > LAYER
> > > >   NAME emptyLayer
> > > >   TYPE RASTER
> > > >   STATUS ON
> > > >   OFFSITE 0
> > > > END
> > > >
> > > > LAYER
> > > >   NAME quad
> > > >   TYPE RASTER
> > > >   STATUS ON
> > > >   DATA quads/pq1119.tif
> > > >   OFFSITE 0
> > > > END
> > > >
> > > > LAYER
> > > >   NAME landuse
> > > >   TYPE POLYGON
> > > >   STATUS ON
> > > >   DATA landuse/eclanduse
> > > >   #DATA landuse/basinslanduse
> > > >   TOLERANCE 5
> > > >
> > > >   CLASSITEM "LUCODE"
> > > >
> > > >   CLASS
> > > >     NAME "Water"
> > > >     EXPRESSION "1"
> > > >     COLOR 49 49 185
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Spruce-Fir"
> > > >     EXPRESSION "2"
> > > >     COLOR 60 180 60
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Ponderosa Pine"
> > > >     EXPRESSION "3"
> > > >     COLOR 20 160 20
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Lodgepole"
> > > >     EXPRESSION "4"
> > > >     COLOR 49 200 10
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Mountain Fir"
> > > >     EXPRESSION "5"
> > > >     COLOR 49 180 185
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Juniper"
> > > >     EXPRESSION "6"
> > > >     COLOR 120 100 40
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Pinyon"
> > > >     EXPRESSION "7"
> > > >     COLOR 0 200 185
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Pinyon-Juniper"
> > > >     EXPRESSION "8"
> > > >     COLOR 120 120 120
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Mountain Mahogany"
> > > >     EXPRESSION "9"
> > > >     COLOR 128 250 130
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Aspen"
> > > >     EXPRESSION "10"
> > > >     COLOR 60 180 10
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Oak"
> > > >     EXPRESSION "11"
> > > >     COLOR 00 190 0
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Maple"
> > > >     EXPRESSION "12"
> > > >     COLOR 250 250 0
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Mountain Shrub"
> > > >     EXPRESSION "13"
> > > >     COLOR 0 199 145
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Sagebrush"
> > > >     EXPRESSION "14"
> > > >     COLOR 20 150 10
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Sagebrush/Perennial Grass"
> > > >     EXPRESSION "15"
> > > >     COLOR 60 255 45
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Grassland"
> > > >     EXPRESSION "16"
> > > >     COLOR 180 250 100
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Alpine"
> > > >     EXPRESSION "17"
> > > >     COLOR 20 160 250
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Dry Meadow"
> > > >     EXPRESSION "18"
> > > >     COLOR 200 200 35
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Wet Meadow"
> > > >     EXPRESSION "19"
> > > >     COLOR 20 199 100
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Barren"
> > > >     EXPRESSION "20"
> > > >     COLOR 200 200 200
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Lodgepole/Aspen"
> > > >     EXPRESSION "150 250 100"
> > > >     COLOR 49 49 185
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Ponderosa Pine/Mountain Shrub"
> > > >     EXPRESSION "22"
> > > >     COLOR 49 49 185
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Spruce-Fir/Mountain Shrub"
> > > >     EXPRESSION "23"
> > > >     COLOR 200 160 20
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Mountain Fir/Mountian Shrub"
> > > >     EXPRESSION "24"
> > > >     COLOR 250 160 0
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Aspen/Conifer"
> > > >     EXPRESSION "25"
> > > >     COLOR 250 250 9
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Mountain Riparian"
> > > >     EXPRESSION "26"
> > > >     COLOR 150 150 50
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Lowland Riparian"
> > > >     EXPRESSION "27"
> > > >     COLOR 49 49 185
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Agriculture"
> > > >     EXPRESSION "30"
> > > >     COLOR 0 255 0
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Urban"
> > > >     EXPRESSION "31"
> > > >     COLOR 50 50 50
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Salt Desert Scrub"
> > > >     EXPRESSION "32"
> > > >     COLOR 120 180 120
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Desert Grassland"
> > > >     EXPRESSION "33"
> > > >     COLOR 49 49 185
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Blackbrush"
> > > >     EXPRESSION "34"
> > > >     COLOR 49 49 185
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Creosote-Bursage"
> > > >     EXPRESSION "35"
> > > >     COLOR 49 49 185
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Greasewood"
> > > >     EXPRESSION "36"
> > > >     COLOR 49 49 185
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Pickleweed Barrens"
> > > >     EXPRESSION "37"
> > > >     COLOR 49 49 185
> > > >   END
> > > >
> > > >   CLASS
> > > >     NAME "Wetland"
> > > >     EXPRESSION "38"
> > > >     COLOR 49 49 185
> > > >   END
> > > >
> > > >   QUERY
> > > >     TEMPLATE query_templates/landuse.html
> > > >   END
> > > > END # Layer
> > > >
> > > > LAYER
> > > >   NAME streams
> > > >   TYPE LINE
> > > >   STATUS DEFAULT
> > > >   #DATA reachfiles/rf3sub
> > > >   DATA reachfiles/basinsrf3
> > > >   TOLERANCE 5
> > > >
> > > >   CLASS
> > > >     SYMBOL 1
> > > >     SIZE 3
> > > >     NAME "Streams"
> > > >     COLOR 0 0 185
> > > >   END
> > > >
> > > > #  QUERY
> > > > #    TEMPLATE query_templates/streams.html
> > > > #  END
> > > > END # Layer
> > > >
> > > > LAYER
> > > >   NAME pointsources
> > > >   TYPE POINT
> > > >   STATUS DEFAULT
> > > >   DATA pointsources/basinssources
> > > >   TOLERANCE 5
> > > >
> > > >   CLASS
> > > >     SYMBOL 2
> > > >     SIZE 6
> > > >     NAME "Pointsources"
> > > >     COLOR 254 0 0
> > > >   END
> > > >
> > > >   QUERY
> > > >     TEMPLATE query_templates/pointsources.html
> > > >   END
> > > > END # Layer
> > > >
> > > > LAYER
> > > >   NAME photos
> > > >   TYPE POINT
> > > >   STATUS DEFAULT
> > > >   DATA media/photos/photos
> > > >   TOLERANCE 5
> > > >
> > > >   CLASS
> > > >     SYMBOL 1
> > > >     SIZE 8
> > > >     NAME "Photos"
> > > >     COLOR 254 0 254
> > > >   END
> > > >
> > > >   QUERY
> > > >     TEMPLATE query_templates/photos.html
> > > >   END
> > > > END # Layer
> > > >
> > > > LAYER
> > > >   NAME flow
> > > >   TYPE POINT
> > > >   STATUS DEFAULT
> > > >   DATA flow/flow
> > > >   TOLERANCE 5
> > > >
> > > >   CLASS
> > > >     SYMBOL 3
> > > >     SIZE 8
> > > >     NAME "Daily Stream Flow Data"
> > > >     COLOR 254 0 254
> > > >   END
> > > >
> > > >   QUERY
> > > >     TEMPLATE query_templates/flow.html
> > > >   END
> > > > END # Layer
> > > >
> > > > LAYER
> > > >   NAME counties
> > > >   TYPE LINE
> > > >   STATUS DEFAULT
> > > >   DATA counties/counties
> > > >   TOLERANCE 5
> > > >
> > > >   CLASS
> > > >     NAME "Counties"
> > > >     COLOR 0 0 0
> > > >   END
> > > >
> > > > #  QUERY
> > > > #    TEMPLATE query_templates/counties.html
> > > > #  END
> > > > END # Layer
> > > >
> > > > END # Map File
> > > >
> >




More information about the MapServer-users mailing list