[OpenLayers-Users] mergeNewParams and MapServer DATA

Ian iansgis at gmail.com
Mon Mar 30 16:15:21 EDT 2009


I'm using MapServer 5.0 and OpenLayers 2.7 to display WMS maps. I am
trying to dynamically change a layer's data source via url,
specifically changing the DATA parameter in the MapServer map file. So
for two spatially-indexed shapefiles (shp1, shp2):

Manually changing the url works:

http://host/cgi-bin/mapserv?map=my.map&LAYERS=myLayer&TRANSPARENT=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&...&map.layer[myLayer]=DATA+shapefiles/shp2

However when I use mergeNewParams:

myLayer.mergeNewParams({"my.map.layer[myLayer]" : "DATA+shapefiles/shp2"});

or:

myLayer.mergeNewParams({"myLayer" : "DATA+shapefiles/shp2"});


I get the error "msUpdateMapFromURL(): General error message. Layer to
be modified not valid." From Firebug it looks like the layer name is
converted to all caps which may be causing a mismatch, but copying and
manually editing the OpenLayers request's layer name gives a different
error:

getString(): Symbol definition error. Parsing error near (+):(line 1)


Any ideas?

Ian



More information about the Users mailing list