[mapserver-users] Validation of mapfiles

Stephen Woodbridge woodbri at swoodbridge.com
Thu Nov 1 06:17:37 PDT 2012


On 11/1/2012 8:22 AM, Per Engström wrote:
> Hi!
>
> I work at theSwedish Meteorological and Hydrological Institute where we
> use MapServer to make  meteorological maps available through WMS. Data
> is read from many sources and we make heavy use of the INCLUDE tag to
> combine various layer definitions into a Mother-Of-Mapfile: mom.map.
> What we need to do is find a way to validate the files that mom.map
> includes - if one of the included files have bad syntax it will break
> the entire mom.map.
>
> Is there a way to validate the syntax of a map-file (other than trying
> to make a request on one of the layers it defines)?
> Is there a list of tags requires a closing END tag - thus making it
> possible to check programmatically that opening and closing tags are
> balanced?

No there is not validation tool to date.

BUT here are some thing I have done in the past to deal with this:

1. wrote a perl script to check tags, worked great, but too much trouble 
to keep it up to date with changes in the mapfile over time

2. create and empty baby of mapfile: bom.map  with the minimum header 
abd footer and one include, like:

MAP
  ...
  INCLUDE "test.inc"
END

then copy you include to test.inc and use shp2img to test it:

shp2img -m bom.map -o junk.png

and it should report any errors.

-Steve W




More information about the MapServer-users mailing list