[mapserver-users] Overriding MapServer Map File Parameters inOpenLayers

Fawcett, David David.Fawcett at state.mn.us
Fri Jan 2 13:31:54 EST 2009


Bill, 

Here is something that I have tested in 5.2

http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/workshop08/runtime_s
ub_config.map&mode=map&map.layer[counties].class[0].style[0]=COLOR+178+3
4+34+WIDTH+3

It changes both the color and width of the line feature, just drop the
'+WIDTH+3' off of the end.

Also, I recommend testing your substitution like this directly in the
URL before attempting to pass it from OpenLayers.

David.

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Bill Thoen
Sent: Friday, January 02, 2009 12:23 PM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Overriding MapServer Map File Parameters
inOpenLayers


I'm trying to make a map in OpenLayers 2.7 using a MapServer 5.0.3 Map 
File, and I'm trying to change the Layer color from what's specified in 
the Map File. In OpenLayers, I have to format the parameter as a key: 
value pair. So here's what I've tried (without success) in my OL
javascript:

var baseLayer = new OpenLayers.Layer.MapServer( "USA",
  "http://206.168.217.244/cgi-bin/mapserv?",
  {
   map_imagetype: 'PNG',
   layer: 'states',
   map_layer_0_class_0_style_0_color: '255+255+000',
   map: '/var/www/html/piper/usa.map'
   }, { singleTile: true });

If I take out this line:
map_layer_0_class_0_style_0_color: '255+255+000'
the map works fine. The only layer in the map is the US states, and all 
I want to do is change the color from pale yellow as set in the map file

to bright yellow.

The relevant part of the map file looks like this:
   LAYER
      NAME "states"
      TYPE POLYGON
      DATA states
      CLASS
         NAME "US States"
         STYLE
            OUTLINECOLOR 100 100 100
            COLOR 255 255 192
         END
      END
      PROJECTION
         "init=epsg:32614" # UTM Zone 14 N WGS84
      END
      STATUS DEFAULT
   END

I think the problem is that I've got the syntax wrong in trying to 
override the MapServer map file parameter. I've looked at 
http://mapserver.osgeo.org/cgi/controls.html#changing-map-file-parameter
s-via-a-form-or-a-url 
but that hasn't helped. So does anyone *here* know how to do this? (I 
was told on the OpenLayers mailing list to try asking on the MapServer 
list.)

TIA,
- Bill Thoen


_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list