[Mapserver-users] mapserver templates

Steve Lime steve.lime at dnr.state.mn.us
Tue Mar 18 17:35:10 EST 2003


The [layers] substitution gives you a list of layers that were
explicitly turned on in
the preceeding call to MapServer. In your example there are none. There
is no way
(via the CGI version) to return a list of all layers. It would be
trivial to add it though.
Just quickly hack maptemplate.c and include something like:

  strcpy(repstr, ""); // list of ALL layers that can be toggled
  for(i=0;i<msObj->Map->numlayers;i++)
    if(msObj->Map->layers[i].status != MS_DEFAULT) sprintf(repstr,
"%s%s ", repstr, msObj->Map->layers[i].name);
  trimBlanks(repstr);
  outstr = gsub(outstr, "[toggle_layers]", repstr);

  encodedstr = msEncodeUrl(repstr);
  outstr = gsub(outstr, "[toggle_layers_esc]", encodedstr);
  free(encodedstr);

in the processLine() function. I've added this to the 3.7 source tree.
The above code gets you a list of all non-default layers, that is,
layers you can turn on and off. There may be some limited use to it but
with groups and query only layers it gets messy quickly...

Steve

Stephen Lime
Data & Applications Manager

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> "Grant Howarth" <Grant.Howarth at divestco.com> 03/17/03 04:19PM >>>
I am trying to use a template to get information about mapserver and a
mapfile.

my template looks simillar to the following:
[mapsize] [mapwidth] [layers] [center]

everything seems to work except for the layers which is the one i am
most interested in.

my .map file has a web entry that references the template

WEB
  TEMPLATE "my_template_name"
END

my cgi call looks similar to the following:
http://sdb/cgi-bin/mapserv?map=/web/sdb/packages/dv-mapping/map/my.map



Is there something that i am missing in order to get a list of the
layernames in the .map file?
Am i approaching this completely wrong?

Thanks in advance.
- Grant


_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu 
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users



More information about the mapserver-users mailing list