Navigation

Creates a tile index Shape data set for use with MapServer’s TILEINDEX
feature. The program creates a Shape data set of rectangles from
extents of all the Shape data sets listed in [metafile] (one Shape
data set name per line) and the associated DBF with the filename for
each shape tile in a column called LOCATION as required by mapserv.

Bemerkung

Similar functionality can be found in the GDAL commandline utilities
ogrtindex (for vectors) and
gdaltindex (for rasters).

This utility creates a Shape data set containing the MBR (minimum
bounding rectangle) of all shapes in the files provided, which can
then be used in the LAYER object’s TILEINDEX parameter of the mapfile.
The new filed created with this command is used by MapServer to only
load the files associated with that extent (or tile).

This example uses TIGER Census data, where the data contains files
divided up by county (in fact there are over 3200 counties, a very
large dataset indeed). In this example we will show how to display
all lakes for the state of Minnesota. (note that here we have already
converted the TIGER data into Shape format, but you could keep the
data in TIGER format and use the ogrtindex utility instead) The TIGER
Census data for Minnesota is made up of 87 different counties, each
containing its own lakes file (‚wp.shp‘).

We need to create the ‚meta-file‘ for the tile4ms command. This is
a text file of the paths to all ‚wp.shp‘ files for the MN state.
To create this file we can use a few simple commands:

Execute the tile4ms command with the newly created meta-file to create the
index file:

tile4mswp_list.txtindexProcessed87of87files

A new file named ‚index.shp‘ is created. This is the index file with the MBRs
of all ‚wp.shp‘ files for the entire state, as shown in Figure1. The attribute
table of this file contains a field named ‚LOCATION‘, that contains the path to
each ‚wp.shp file‘, as shown in Figure2.

Figure 1: Index file created by tile4ms utility

Figure 2: Attributes of index file created by tile4ms utility

The final step is to use this in your mapfile.

LAYER object’s TILEINDEX - must point to the location of the
index file

LAYER object’s TILEITEM - specify the name of the field in the
index file containing the paths (default is ‚location‘)