Mapfile Metadata Configuration

From Ka-Map Wiki

Jump to: navigation, search

Contents

[edit] ka-Map! Mapfile Metadata Configuration

[edit] About Mapfile Metadata

  • Map level metadata conrols map-wide behaviour and is defined in the WEB object with key/value pairs.
 WEB
   METADATA
     "key" "value"
   END
 END
  • Layer level metadata controls behaviour of individual layers. For grouped layers, any metadata defined on the first (topmost in the mapfile) layer of the group will be used for the whole group. Metadata defined on layers other than the first layer of a group will be ignored.
 LAYER
   METADATA
     "key" "value"
   END
 END

[edit] ka-Map! Metadata Configuration Reference

[edit] Mapfile WEB Section

  • In ka-Map!, the following metadata key/value pairs have special meaning when they are placed in the WEB object's metadata block:
"max_extents" ["minx, miny, maxx, maxy" | "auto"]
Specifying a maximum extent limits panning & zooming to the given coordinates. (Note that if max_extents is specified, Pre-caching system will generate cached tiles to this extent.) Alternately, you can use the "auto" value for max_extents to define the maximum extent to be the same as the map EXTENT.
"version" "<any string>"
the version of the map file. This can be any arbitrary string value (an integer or a cvs id tag for instance) that indicates the current version of the map file. Multiple versions should compare sensibly using < operator. This works for most string values where you increment some number or letter. The client is informed of the version through init.php and the version is included with every tile request. This solves two problems. First, a cache can be invalidated by modifying the version without having to delete all the files in the cache. Second, clients that have cached tiles will generate different urls for tiles when the map changes, forcing them to download the latest version of the mapfile.

[edit] Mapfile LAYER Section

  • The key/value pairs below have special meaning in ka-Map
"opacity" [integer]
Opacity set the default opacity of a layer. Opacity should be a value from 1 (almost completely transparent) to 100 (completely opaque).
"imageformat" [DITHERED|PNG24|PNG|JPEG|GIF]
One of the valid formats for rendering tiles. This overrides the overall map setting for output format for a specific group of layers. This allows rendering vectors using a smaller format such as PNG and rendering raster imagery using PNG24 or JPEG (for instance).
Dithered is a special format that uses PNG24 in MapServer to render the group of layers but then reduces it to an 8-bit format (PNG)
This option is especially useful when using antialiased labels and thick lines and you experience corruption of the colour table (especially noticeable in symbols).
The default is to use the config.php setting for the map.
"queryable" ["true" | "false"]
Determines whether a layer can be queried. The default is false.
"SEARCHFIELD" "layer_field_name" 
Set the fields to search for data from the search input. Remember to setup a template.html
"fields"
"fields" "fieldname1:alias1,fieldname2:alias2,fiendname3:alias3" : Give fields aliases
"tile_source" ["auto" | "cache" | "redraw" | "nocache"]
Depending on the type of data contained in a layer, it may make sense to specify where the tile should be requested. The default behavior is to let tile.php decide whether or not to render a new tile (this is the same as specifying "auto"). If you have pre-rendered all your tiles, you can specify "cache" to have tiles requested from the cache directly - this requires that you also specify a web accessible path to your cache in config.php. Finally, if you have data that is dynamically defined (by client side parameters for example), specify "nocache". The "nocache" option has two effects: it redraws tiles without using the cache and without creating larger metatiles, and it uses MapServer CGI style replacement variables. To specify values for variable replacement on the client side, add a replacementVariables object to your JavaScript _layer object (e.g. myLayer.replacementVariables = {key1: 'value1', key2: 'value2'}). Variable replacement currently works for layer->data, layer->connection, layer->filter, and for class->expression.
"redraw_interval" "n"
the interval, in seconds, at which the data in the cache is considered to be stale. When the ka-Map client requests tiles and the tile source is set to redraw, it will pass the current timestamp for the entire layer/group and the redraw interval. Passing a layer-wide timestamp will avoid previous problems with the redraw method by allowing tiles to be cached at least temporarily so that the server doesn't re-generate the meta-tile for every tile request. kaMap's _layer objects now have a redraw() method which can be called manually to update the timestamp. On the server side, tile.php will only re-render the tiles if the timestamp requested is newer that the timestamp at which the tiles where cached plus the redraw interval. Note that all timestamps are in GMT and that daylight savings will be accomodated if the client/server is aware of daylight savings. If the client or server clock is not accurate then a couple of things can happen. First, the client may never request new tiles properly if the server's time is too far ahead or the client is too far behind. In the opposite case where the client is ahead of the server, the request is ignored and cached tiles are returned. The tolerance for the client being ahead of the server is the refresh interval, or 30 seconds if no redraw interval is provided.
"refresh_interval" "n"
the interval at which the layer/group should be automatically refreshed by the client. If not specified or <=0, the layer/group will not be automatically refreshed. This is most effective when combined with tile_source "redraw" or tile_source "nocache" for periodically changing data.


Source code reference in init.php
Personal tools