1

I started looking into using something similar to this example of the GRID layer definition in a MapServer mapfile that will draw lat/lon line grid at least every 5 degrees:

LAYER
  NAME "grid"
  METADATA
    "DESCRIPTION" "Grid"
  END
  TYPE LINE
  STATUS ON
  CLASS
    NAME "Graticule"
    COLOR 0 0 0
    LABEL
      COLOR  255 0 0
      FONT "sans"
      TYPE truetype
      SIZE 8
      POSITION AUTO
      PARTIALS FALSE
      BUFFER 2
      OUTLINECOLOR 255 255 255
    END
  END
  PROJECTION
    "init=epsg:4326"
  END
  GRID
    LABELFORMAT '%g°'
    MININTERVAL 5
  END
END # Layer

However, I don't want the MININTERVAL value to be hardcoded and would like to be able to vary that value by entering a different value in the URL call from a web page using the map_object notation. But, I've been unsuccessful. I have tried this in the URL call to MapServer:

&map_layer[grid].grid[0]=MININTERVAL+10 #changing to 10 degrees instead of 5

using the second example at this link: https://mapserver.org/cgi/controls.html#cgi-mapfile-change-parameters. But, I either get a parsing error or an Internal Server error. I've tried turning debug level to 5 and looking at logs but they don't offer any help. Perhaps I'm just not using the correct map_object notation, but I'm not sure what else to use given the examples in the link. I also attempted to look at the MapServer code to no avail.

I'm using MapServer v 7.2.2 but it seems like the GRID layer has been available for a while now.

0

Apparently, the map_object_property type syntax has the same restrictions as the runtime substitution. The GRID MININTERVAL is not in the list of supported parameters.

  • Yes, I checked that section first in case I could just pass the value in because changing via URL is a bit cumbersome. While my results are leading me to believe what you said is true, there's also this statement from the "Changing map file parameters via a form or a URL": "Beginning with version 3.3 it is possible to change virtually any map file value from a form or a URL." So, I'll still hold out for a possible solution here. Thanks. – teknocreator Sep 2 '20 at 12:03
  • Apparently, "virtually any" means that list. – CL. Sep 2 '20 at 12:23
0

As @CL had thought, I confirmed with Steve L at MapServer that indeed "none of the relevant grid keywords (GRID, MINTERVAL, LABELFORMAT) are recognized when in URL context." The GRID layer functionality was geared towards common use cases. Therefore, in case anyone else would have a similar need, Steve suggested a work around would be to have multiple GRID layers with different settings, e.g. layer name "grid1" would have MININTERVAL 1, "grid5" would have MININTERVAL 5, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.