Opened 20 years ago

Closed 19 years ago

Last modified 19 years ago

#827 closed defect (fixed)

Add layers=all for debugging

Reported by: dmorissette Owned by: dmorissette
Priority: high Milestone: 4.4 release
Component: MapServer CGI Version: 4.3
Severity: normal Keywords:
Cc: frank.koormann@…, woodbri@…

Description

Steve,

What would you think of adding the ability to pass "layers=all" to the mapserv
CGI to automatically display all layers that have status=on. I've used this hack
before to quickly test mapfiles, and others (Steve W.) seem to find it useful as
well.

Change History (7)

comment:1 by sdlime, 20 years ago

Sounds ok to me. You've already got the code right? Would this just turn on a
loop someplace to turn all the layers ON or would you also set the msObj->Layers
variable?

Steve

comment:2 by sdlime, 20 years ago

I forgot to add that the former, just a loop somewhere in the main program seems
easiest to me...

Steve

comment:3 by dmorissette, 19 years ago

Cc: steve.lime@… added
Owner: changed from sdlime to dmorissette@…
Here is the loop that I had... this was in 3.6, I'll look at integrating into
4.3 now:

    if(strncasecmp(msObj->ParamNames[i],"layers", 6) == 0) { // turn a set of
layers, delimited by spaces, on
      int num_layers=0, l;
      char **layers=NULL;

      /* IF layers=all then enable all layers - Custom hack DM, 20030511 */
      if (strcasecmp(msObj->ParamValues[i], "all") == 0 && msObj->Map != NULL)
      {
          /* Yes we reset NumLayers and this may result in a small memory
leak... no big deal */
          for(msObj->NumLayers=0; msObj->NumLayers < msObj->Map->numlayers;
msObj->NumLayers++)
          {
              if (msObj->Map->layers[msObj->NumLayers].name)
              {
                  msObj->Layers[msObj->NumLayers] =
strdup(msObj->Map->layers[msObj->NumLayers].name);
              }
              else
              {
                  msObj->Layers[msObj->NumLayers] = strdup("");
              }
          }
          continue;
      }


      layers = split(msObj->ParamValues[i], ' ', &(num_layers));
      for(l=0; l<num_layers; l++)
        msObj->Layers[msObj->NumLayers+l] = strdup(layers[l]);
      msObj->NumLayers += l;

      msFreeCharArray(layers, num_layers);
      num_layers = 0;
      continue;
    }

comment:4 by dmorissette, 19 years ago

Status: newassigned

comment:5 by dmorissette, 19 years ago

Milestone: 4.4 release

comment:6 by dmorissette, 19 years ago

Resolution: fixed
Status: assignedclosed
Fixed. Implemented in 4.3.

Of course I have reorganized the sample code above to not leak memory. Note that
this will work only for the mapserv CGI and doesn't do anything for the WMS or
MapScript.

comment:7 by dmorissette, 19 years ago

Cc: frank.koormann@… added
I have updated the cgi-reference.xml with a note about the LAYERS=all shortcut.
Adding Frank K. (owner of the cgi-=reference doc) to the CC in case I broke
something.
Note: See TracTickets for help on using tickets.