[mapserver-users] Overriding MapServer Map File Parameters in OpenLayers
Bill Thoen
bthoen at gisnet.com
Fri Jan 2 10:22:48 PST 2009
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-parameters-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
More information about the MapServer-users
mailing list