EnglishFrenchSpanish

OnWorks favicon

tile4ms - Online in the Cloud

Run tile4ms in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command tile4ms that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


tile4ms - create a tile index Shape data set for use with MapServer's TILEINDEX feature

SYNOPSIS


tile4ms [ metafile tilefile [-tile-path-only] | -h]

DESCRIPTION


tile4ms 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.

Note: Similar functionality can be found in the GDAL commandline utilities ogrtindex
http://www.gdal.org/ogrtindex.html⟩ (for vectors) and gdaltindex ⟨http://www.gdal.org/
gdaltindex.html⟩ (for rasters).

tile4ms 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 assocated with that extent (or tile).

OPTIONS


metafile
INPUT file containing list of shapefile names. (complete paths 255 chars max, no
extension)

tilefile
OUTPUT shape file of extent rectangles and names of tiles in tilefile.dbf

-tile-path-only
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.

-h Display usage information

EXAMPLE


Short Example

Create tileindex.shp for all tiles under the /path/to/data directory:

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

Long Example

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').

1. 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:

find -name *wp.shp -print > wp_list.txt

The newly created file might look like the following (after removing the full path):

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
...

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

tile4ms wp_list.txt index
Processed 87 of 87 files

3. 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 1: Index file created by tile4ms utilityhttp://mapserver.org/_images/
tile4ms-view.png⟩

Figure 2: Attributes of index file created by tile4ms utilityhttp://mapserver.org/
_images/tile4ms-attributes.png⟩

4. 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')

· do not need to use the LAYER's DATA parameter

For example:

LAYER
NAME 'mn-lakes'
STATUS ON
TILEINDEX "index"
TILEITEM "location"
TYPE POLYGON
CLASS
NAME "mn-lakes"
STYLE
COLOR 0 0 255
END
END
END

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.

Use tile4ms online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

  • 1
    Phaser
    Phaser
    Phaser is a fast, free, and fun open
    source HTML5 game framework that offers
    WebGL and Canvas rendering across
    desktop and mobile web browsers. Games
    can be co...
    Download Phaser
  • 2
    VASSAL Engine
    VASSAL Engine
    VASSAL is a game engine for creating
    electronic versions of traditional board
    and card games. It provides support for
    game piece rendering and interaction,
    and...
    Download VASSAL Engine
  • 3
    OpenPDF - Fork of iText
    OpenPDF - Fork of iText
    OpenPDF is a Java library for creating
    and editing PDF files with a LGPL and
    MPL open source license. OpenPDF is the
    LGPL/MPL open source successor of iText,
    a...
    Download OpenPDF - Fork of iText
  • 4
    SAGA GIS
    SAGA GIS
    SAGA - System for Automated
    Geoscientific Analyses - is a Geographic
    Information System (GIS) software with
    immense capabilities for geodata
    processing and ana...
    Download SAGA GIS
  • 5
    Toolbox for Java/JTOpen
    Toolbox for Java/JTOpen
    The IBM Toolbox for Java / JTOpen is a
    library of Java classes supporting the
    client/server and internet programming
    models to a system running OS/400,
    i5/OS, o...
    Download Toolbox for Java/JTOpen
  • 6
    D3.js
    D3.js
    D3.js (or D3 for Data-Driven Documents)
    is a JavaScript library that allows you
    to produce dynamic, interactive data
    visualizations in web browsers. With D3
    you...
    Download D3.js
  • More »

Linux commands

Ad