[mapserver-users] Mapfile Variables

Matt McClelland matt at wildwalks.com
Tue Jun 19 14:51:32 PDT 2012


Thanks for the responses

Both seem to work. I am going to run with the include approach.  Gives me a
few 'bonus features'.
I will write a short PHP script that will allow me to make these changes
easily online.

Gee I love mapserver :)

Matt  :)


On Wed, Jun 20, 2012 at 2:30 AM, Rahkonen Jukka
<Jukka.Rahkonen at mmmtike.fi>wrote:

> Hi,
>
> My shortish answer is that have a try with INCLUDE. If you had
>
> STYLE
>            WIDTH 10
>            OUTLINEWIDTH 1
>            OUTLINECOLOR "#24277A"
> END
> STYLE
>            WIDTH 10
>            COLOR "#4F719D"
> END
>
> try changing it to
>
> STYLE
>            WIDTH 10
>            OUTLINEWIDTH 1
>            INCLUDE "\styles\my_motorway_outline_color.txt"
> END
> STYLE
>            WIDTH 10
>            INCLUDE "\styles\my_motorway_line_color.txt"
> END
>
> Next create and save the corresponding files
> "my_motorway_outline_color.txt" and "my_motorway_line_color" as
>
> OUTLINECOLOR "#24277A"
> and
> COLOR "#4F719D"
>
> I have never tried that but it should work.
>
> -Jukka Rahkonen-
>
> Stephen Woodbridge wrote:
>
> On 6/19/2012 2:15 AM, Matt McClelland wrote:
> > Hi All
> >
> > Is is possible create and use variables within a mapfile?
> > IE I want to store the colour of a road in one place, then reference
> > that colour in the several style tags
> >
> > EG
> > $road_colour_inside = "255 0 0 "
> > then later in the style tags be able to do
> > color $road_colour_inside
> >
> > Or something similar.
> >
> > I am using v6.0
>
> Short answer is no.
> What I and others have done as a workaround to this is to use the cpp,
> the C preprocessor.
>
> EG
>
> #define _ROAD_COLOR_INSIDE "255 0 0"
>
> COLOR _ROAD_COLOR_INSIDE
>
>
> Then run the cpp, If you want to see a great example of this look at:
>
> https://github.com/mapserver/basemaps
>
> -Steve W
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120620/e98a3077/attachment.html>


More information about the mapserver-users mailing list