MapServer Utility Programs

These utilities are included with the MapServer distribution.  User contributed utilities and other  freely available tools are available here.x

shp2img

Purpose: Creates a map from a mapfile. Output is either PNG or GIF depending on what version of the GD library used.
Syntax: shp2img -m [mapfile] -o [image] -t -l [layers]

legend

Purpose: Creates a legend from a mapfile. Output is either PNG or GIF depending on what version of the GD library used.
Syntax: legend [mapfile] [output image]

scalebar

Purpose: Creates a scalebar from a mapfile. Output is either PNG or GIF depending on what version of the GD library used.
Syntax: scalebar [mapfile] [output image]

sortshp

Purpose: Sorts a shapefile based on a single column in ascending or descending order. Supports INTEGER, DOUBLE and STRING column types. Useful for prioritizing shapes for rendering and/or labeling.
Syntax: sortshp [infile] [outfile] [item] [ascending|descending]

sym2img

Purpose: Creates a graphic dump of a symbol file. Output is either PNG or GIF depending on what version of the GD library used.
Syntax: sym2img [symbolfile] [outfile]

shptree

Purpose: Creates a quadtree-based spatial index for a shapefile.   The default tree depth is calculated so that each tree node (quadtree cell) contains 8 shapes. Do not use the default with point files, a value between 6 and 10 seems to work ok.  Your millage may vary and you'll need to do some experimenting.
Syntax: shptree [shpfile] {depth}

tile4ms

Purpose: Creates a tile index shapefile for use with MapServer's TILEINDEX feature. The program creates a shapefile of rectangles from extents of all the shapefiles listed in [metafile] (one shapefile name per line) and the associated DBF with the filename for each shape tile in a column called LOCATION as required by mapserv.
Syntax: tile4ms [metafile] [tilefile] [-tile-path-only]
-tile-path-only is an optional flag which specifies that only the path to the shape file should be stored in the LOCATION field.
Example: create tileindex.shp for all tiles under the /path/to/data directory (works only on Unix):

       cd /path/to/data
       find . -name "*.shp" -print > metafile.txt
       tile4ms metafile.txt tileindex

[Homepage]  [Download]  [Documentation]  [Support]  [Gallery]