1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<refentry id='tile4ms'>
<refmeta>
<refentrytitle>tile4ms</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>tile4ms</refname>
<refpurpose>create a tile index Shape data set for use with MapServer's TILEINDEX feature</refpurpose>
</refnamediv>
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
<command>tile4ms</command>
<group>
<arg choice='plain'>
<replaceable>metafile</replaceable>
<arg choice='plain'><replaceable>tilefile</replaceable></arg>
<arg choice='opt'><option>-tile-path-only</option></arg>
</arg>
<arg choice='plain'><option>-h</option></arg>
</group>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id='description'>
<title>DESCRIPTION</title>
<para>
<command>tile4ms</command> 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
<replaceable>metafile</replaceable> (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.
</para>
<para>
<emphasis>Note:</emphasis>
Similar functionality can be found in the GDAL commandline utilities
<ulink url="http://www.gdal.org/ogrtindex.html">ogrtindex</ulink> (for
vectors) and
<ulink url="http://www.gdal.org/gdaltindex.html">gdaltindex</ulink> (for
rasters).
</para>
<para>
<command>tile4ms</command> 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).
</para>
</refsect1>
<refsect1 id='options'>
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term><replaceable>metafile</replaceable></term>
<listitem>
<para>
INPUT file containing list of shapefile names.
(complete paths 255 chars max, no extension)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>tilefile</replaceable></term>
<listitem>
<para>
OUTPUT shape file of extent rectangles and names of tiles in
<replaceable>tilefile</replaceable>.dbf
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-tile-path-only</option></term>
<listitem>
<para>
Optional flag. If specified then only the path to the shape files
will be stored in the LOCATION field instead of storing the full
filename.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option></term>
<listitem>
<para>Display usage information</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='example'>
<title>EXAMPLE</title>
<example>
<title>Short Example</title>
<para>
Create tileindex.shp for all tiles under the /path/to/data directory:
</para>
<screen>
cd /path/to/data
find . -name "/*.shp" -print > metafile.txt
tile4ms metafile.txt tileindex
</screen>
</example>
<example>
<title>Long Example</title>
<para>
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').
</para>
<orderedlist>
<listitem>
<para>
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:
</para>
<screen>
find -name *wp.shp -print > wp_list.txt
</screen>
<para>
The newly created file might look like the following (after removing
the full path):
<programlisting>
001\wp.shp
003\wp.shp
005\wp.shp
007\wp.shp
009\wp.shp
011\wp.shp
013\wp.shp
015\wp.shp
017\wp.shp
019\wp.shp
...
</programlisting>
</para>
</listitem>
<listitem>
<para>
Execute the tile4ms command with the newly created meta-file to
create the index file:
<screen>
tile4ms wp_list.txt index
Processed 87 of 87 files
</screen>
</para>
</listitem>
<listitem>
<para>
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
Figure 1. The attribute table of this file contains a field named
'LOCATION', that contains the path to each 'wp.shp file', as shown
in Figure 2.
<figure>
<title>Figure 1: Index file created by tile4ms utility</title>
<ulink url="http://mapserver.org/_images/tile4ms-view.png"/>
</figure>
<figure>
<title>Figure 2: Attributes of index file created by tile4ms utility</title>
<ulink url="http://mapserver.org/_images/tile4ms-attributes.png"/>
</figure>
</para>
</listitem>
<listitem>
<para>
The final step is to use this in your mapfile.
<itemizedlist>
<listitem>
<para>
LAYER object's TILEINDEX - must point to the location of the
index file
</para>
</listitem>
<listitem>
<para>
LAYER object's TILEITEM - specify the name of the field in the
index file containing the paths (default is 'location')
</para>
</listitem>
<listitem>
<para>
do not need to use the LAYER's DATA parameter
</para>
</listitem>
</itemizedlist>
<para>
<blockquote>
For example:
<programlisting>
LAYER
NAME 'mn-lakes'
STATUS ON
TILEINDEX "index"
TILEITEM "location"
TYPE POLYGON
CLASS
NAME "mn-lakes"
STYLE
COLOR 0 0 255
END
END
END
</programlisting>
</blockquote>
</para>
When you view the layer in a MapServer application, you will notice
that when you are zoomed into a small area of the state only those
lakes layers are loaded, which speeds up the application.
</para>
</listitem>
</orderedlist>
</example>
</refsect1>
<refsect1 id='see-also'>
<title>SEE ALSO</title>
<citerefentry>
<refentrytitle>map2img</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>shptree</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>shptreetst</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>shptreevis</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>sortshp</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>
</refsect1>
</refentry>
|