.. index:: single: LAYER .. _layer: ***************************************************************************** LAYER ***************************************************************************** .. index:: pair: LAYER; CLASS :ref:`CLASS` Signals the start of a :ref:`CLASS` object. Inside a layer, only a single class will be used for the rendering of a feature. Each feature is tested against each class in the order in which they are defined in the mapfile. The first class that matches the its min/max scale constraints and its :ref:`EXPRESSION ` check for the current feature will be used for rendering. .. index:: pair: LAYER; CLASSGROUP CLASSGROUP [string] Specify the class's group that would be considered at rendering time. The :ref:`CLASS` object's GROUP parameter must be used in combination with CLASSGROUP. .. index:: pair: LAYER; CLASSITEM .. _CLASSITEM: CLASSITEM [attribute] Item name in attribute table to use for class lookups. .. index:: pair: LAYER; CLUSTER :ref:`CLUSTER` Signals the start of a :ref:`CLUSTER` object. The CLUSTER configuration option provides to combine multiple features from the layer into single (aggregated) features based on their relative positions. Supported only for POINT layers. .. seealso:: :ref:`rfc69` .. index:: pair: LAYER; CONNECTION CONNECTION [string] Database connection string to retrieve remote data. An SDE connection string consists of a hostname, instance name, database name, username and password separated by commas. A PostGIS connection string is basically a regular PostgreSQL connection string, it takes the form of "user=nobody password=****** dbname=dbname host=localhost port=5432" An Oracle connection string: user/pass[@db] .. seealso:: See :ref:`vector` for specific connection information for various data sources. .. index:: pair: LAYER; CONNECTIONTYPE .. index:: triple: LAYER; CONNECTIONTYPE; local .. index:: triple: LAYER; CONNECTIONTYPE; ogr .. index:: triple: LAYER; CONNECTIONTYPE; oraclespatial .. index:: triple: LAYER; CONNECTIONTYPE; plugin .. index:: triple: LAYER; CONNECTIONTYPE; postgis .. index:: triple: LAYER; CONNECTIONTYPE; sde .. index:: triple: LAYER; CONNECTIONTYPE; union .. index:: triple: LAYER; CONNECTIONTYPE; uvraster .. index:: triple: LAYER; CONNECTIONTYPE; wfs .. index:: triple: LAYER; CONNECTIONTYPE; wms CONNECTIONTYPE [local|ogr|oraclespatial|plugin|postgis|sde|union|uvraster|wfs|wms] Type of connection. Default is local. See additional documentation for any other type. .. seealso:: See :ref:`vector` for specific connection information for various data sources. See :ref:`union` for combining layers, added in MapServer 6.0 .. note:: *mygis* is another connectiontype, but it is deprecated; please see the :ref:`MySQL section ` of the Vector Data document for connection details. .. index:: pair: LAYER; DATA DATA [filename]|[sde parameters][postgis table/column][oracle table/column] Full filename of the spatial data to process. No file extension is necessary for shapefiles. Can be specified relative to the SHAPEPATH option from the Map Object. If this is an SDE layer, the parameter should include the name of the layer as well as the geometry column, i.e. "mylayer,shape,myversion". If this is a PostGIS layer, the parameter should be in the form of " from ", where "columnname" is the name of the column containing the geometry objects and "tablename" is the name of the table from which the geometry data will be read. For Oracle, use "shape FROM table" or "shape FROM (SELECT statement)" or even more complex Oracle compliant queries! Note that there are important performance impacts when using spatial subqueries however. Try using MapServer's FILTER_ whenever possible instead. You can also see the SQL submitted by forcing an error, for instance by submitting a DATA parameter you know won't work, using for example a bad column name. .. seealso:: See :ref:`vector` for specific connection information for various data sources. .. index:: pair: LAYER; DEBUG DEBUG [off|on|0|1|2|3|4|5] Enables debugging of a layer in the current map. *Debugging with MapServer versions >= 5.0:* Verbose output is generated and sent to the standard error output (STDERR) or the MapServer errorfile if one is set using the "MS_ERRORFILE" environment variable. You can set the environment variable by using the CONFIG parameter at the MAP level of the mapfile, such as: .. code-block:: mapfile CONFIG "MS_ERRORFILE" "/ms4w/tmp/ms_error.txt" You can also set the environment variable in Apache by adding the following to your httpd.conf: :: SetEnv MS_ERRORFILE "/ms4w/tmp/ms_error.txt" Once the environment variable is set, the DEBUG mapfile parameter can be used to control the level of debugging output. Here is a description of the possible DEBUG values: - **DEBUG O or OFF** - only msSetError() calls are logged to MS_ERRORFILE. No msDebug() output at all. This is the default and corresponds to the original behavior of MS_ERRORFILE in MapServer 4.x - **DEBUG 1 or ON** - includes all output from DEBUG 0 plus msDebug() warnings about common pitfalls, failed assertions or non-fatal error situations (e.g. missing or invalid values for some parameters, missing shapefiles in tileindex, timeout error from remote WMS/WFS servers, etc.) - **DEBUG 2** - includes all output from DEBUG 1 plus notices and timing information useful for tuning mapfiles and applications - **DEBUG 3** - all of DEBUG 2 plus some debug output useful in troubleshooting problems such as WMS connection URLs being called, database connection calls, etc. This is the recommended level for debugging mapfiles. - **DEBUG 4** - DEBUG 3 plus even more details... - **DEBUG 5** - DEBUG 4 plus any msDebug() output that might be more useful to the developers than to the users. You can also set the debug level by using the "MS_DEBUGLEVEL" environment variable. The DEBUG setting can also be specified for the entire map, by setting the DEBUG parameter in the :ref:`MAP` object. For more details on this debugging mechanism, please see :ref:`RFC28`. *Debugging with MapServer versions < 5:* Verbose output is generated and sent to the standard error output (STDERR) or the MapServer logfile if one is set using the LOG parameter in the WEB object. Apache users will see timing details for drawing in Apache's error_log file. Requires MapServer to be built with the DEBUG=MSDEBUG option (--with-debug configure option). .. index:: pair: LAYER; DUMP DUMP [true|false] Switch to allow MapServer to return data in GML format. Useful when used with WMS GetFeatureInfo operations. "false" by default. .. deprecated:: 6.0 `LAYER` `METADATA` is used instead. .. seealso:: :ref:`WMS_SERVER` .. index:: pair: LAYER; EXTENT EXTENT [minx] [miny] [maxx] [maxy] The spatial extent of the data. In most cases you will not need to specify this, but it can be used to avoid the speed cost of having MapServer compute the extents of the data. An application can also possibly use this value to override the extents of the map. .. index:: pair: LAYER; FEATURE :ref:`FEATURE` Signals the start of a :ref:`FEATURE` object. .. index:: pair: LAYER; FILTER .. _FILTER: FILTER [string] This parameter allows for data specific attribute filtering that is done at the same time spatial filtering is done, but before any CLASS expressions are evaluated. For OGR and shapefiles the string is simply a mapserver regular expression. For spatial databases the string is a SQL WHERE clause that is valid with respect to the underlying database. For example: FILTER ([type]='road' and [size]<2) .. index:: pair: LAYER; FILTERITEM FILTERITEM [attribute] Item to use with simple FILTER_ expressions. OGR and shapefiles only. .. index:: pair: LAYER; FOOTER FOOTER [filename] Template to use *after* a layer's set of results have been sent. Multiresult query modes only. .. index:: pair: LAYER; GRID :ref:`GRID` Signals the start of a :ref:`GRID` object. .. index:: pair: LAYER; GROUP GROUP [name] Name of a group that this layer belongs to. The group name can then be reference as a regular layer name in the template files, allowing to do things like turning on and off a group of layers at once. If a group name is present in the LAYERS parameter of a CGI request, all the layers of the group are returned (the `STATUS` of the `LAYER`\s have no effect). .. index:: pair: LAYER; HEADER HEADER [filename] Template to use *before* a layer's set of results have been sent. Multiresult query modes only. .. index:: pair: LAYER; JOIN :ref:`JOIN` Signals the start of a :ref:`JOIN` object. LABELANGLEITEM [attribute] (As of MapServer 5.0 this parameter is no longer available. Please see the :ref:`LABEL` object's ANGLE parameter) For MapServer versions < 5.0, this is the item name in attribute table to use for class annotation angles. Values should be in degrees. .. deprecated:: 5.0 .. index:: pair: LAYER; LABELCACHE LABELCACHE [on|off] Specifies whether labels should be drawn as the features for this layer are drawn, or whether they should be cached and drawn after all layers have been drawn. Default is on. Label overlap removal, auto placement etc... are only available when the label cache is active. .. index:: pair: LAYER; LABELITEM LABELITEM [attribute] Item name in attribute table to use for class annotation (i.e. labeling). .. index:: pair: LAYER; LABELMAXSCALEDENOM LABELMAXSCALEDENOM [double] Minimum scale at which this LAYER is labeled. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000. Implemented in MapServer 5.0, to replace the deprecated LABELMAXSCALE parameter. .. seealso:: :term:`Map Scale` LABELMAXSCALE [double] - deprecated Since MapServer 5.0 the proper parameter to use is LABELMAXSCALEDENOM instead. The deprecated LABELMAXSCALE is the minimum scale at which this LAYER is labeled. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000. .. deprecated:: 5.0 .. index:: pair: LAYER; LABELMINSCALEDENOM LABELMINSCALEDENOM [double] Maximum scale at which this LAYER is labeled. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000. Implemented in MapServer 5.0, to replace the deprecated LABELMINSCALE parameter. .. seealso:: :term:`Map Scale` LABELMINSCALE [double] - deprecated Since MapServer 5.0 the proper parameter to use is LABELMINSCALEDENOM instead. The deprecated LABELMINSCALE is the maximum scale at which this LAYER is labeled. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000. .. deprecated:: 5.0 .. index:: pair: LAYER; LABELREQUIRES .. _LABELREQUIRES: LABELREQUIRES [expression] Sets context for labeling this layer, for example: .. code-block:: mapfile LABELREQUIRES "![orthoquads]" means that this layer would NOT be labeled if a layer named "orthoquads" is on. The expression consists of a boolean expression based on the status of other layers, each [layer name] substring is replaced by a 0 or a 1 depending on that layer's STATUS_ and then evaluated as normal. Logical operators AND and OR can be used. LABELSIZEITEM [attribute] (As of MapServer 5.0 this parameter is no longer available. Please see the :ref:`LABEL` object's SIZE parameter) For MapServer versions < 5.0, this is the item name in attribute table to use for class annotation sizes. Values should be in pixels. .. deprecated:: 5.0 .. index:: pair: LAYER; MAXFEATURES MAXFEATURES [integer] Specifies the number of features that should be drawn for this layer in the CURRENT window. Has some interesting uses with annotation and with sorted data (i.e. lakes by area). .. index:: pair: LAYER; MAXGEOWIDTH MAXGEOWIDTH [double] Maximum width, in the map's geographic units, at which this LAYER is drawn. If MAXSCALEDENOM is also specified then MAXSCALEDENOM will be used instead. *(added in MapServer 5.4.0)* The width of a map in geographic units can be found by calculating the following from the extents:: [maxx] - [minx] .. index:: pair: LAYER; MAXSCALEDENOM MAXSCALEDENOM [double] Minimum scale at which this LAYER is drawn. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000. Implemented in MapServer 5.0, to replace the deprecated MAXSCALE parameter. .. seealso:: :term:`Map Scale` MAXSCALE [double] - deprecated Since MapServer 5.0 the proper parameter to use is MAXSCALEDENOM instead. The deprecated MAXSCALE is the minimum scale at which this LAYER is drawn. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000. .. deprecated:: 5.0 .. index:: pair: LAYER; METADATA METADATA This keyword allows for arbitrary data to be stored as name value pairs. This is used with :ref:`OGC WMS ` to define things such as layer title. It can also allow more flexibility in creating templates, as anything you put in here will be accessible via template tags. Example: .. code-block:: mapfile METADATA "title" "My layer title" "author" "Me!" END .. index:: pair: LAYER; MINGEOWIDTH MINGEOWIDTH [double] Minimum width, in the map's geographic units, at which this LAYER is drawn. If MINSCALEDENOM is also specified then MINSCALEDENOM will be used instead. *(added in MapServer 5.4.0)* The width of a map in geographic units can be found by calculating the following from the extents:: [maxx] - [minx] .. index:: pair: LAYER; MINSCALEDENOM MINSCALEDENOM [double] Maximum scale at which this LAYER is drawn. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000. Implemented in MapServer 5.0, to replace the deprecated MINSCALE parameter. .. seealso:: :term:`Map Scale` MINSCALE [double] - deprecated Since MapServer 5.0 the proper parameter to use is MINSCALEDENOM instead. The deprecated MINSCALE is the maximum scale at which this LAYER is drawn. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000. .. deprecated:: 5.0 .. index:: pair: LAYER; NAME NAME [string] Short name for this layer. This name is the link between the mapfile and web interfaces that refer to this name. They must be identical. The name should be unique, unless one layer replaces another at different scales. Use the GROUP option to associate layers with each other. It is recommended that the name not contain spaces, special characters, or begin with a number (which could cause problems through interfaces such as OGC services). .. index:: pair: LAYER; OFFSITE OFFSITE [r] [g] [b] Sets the color index to treat as transparent for raster layers. .. index:: pair: LAYER; OPACITY .. _OPACITY: OPACITY [integer|alpha] Sets the opacity level (or the inability to see through the layer) of all classed pixels for a given layer. The value can either be an integer in the range (0-100) or the named symbol "ALPHA". A value of 100 is opaque and 0 is fully transparent. Implemented in MapServer 5.0, to replace the deprecated TRANSPARENCY parameter. The "ALPHA" symbol directs the MapServer rendering code to honor the indexed or alpha transparency of pixmap symbols used to style a layer. This is only needed in the case of RGB output formats, and should be used only when necessary as it is expensive to render transparent pixmap symbols onto an RGB map image. .. index:: pair: LAYER; PLUGIN PLUGIN [filename] Additional library to load by MapServer, for this layer. This is commonly used to load specific support for SDE and Microsoft SQL Server layers, such as: .. code-block:: mapfile CONNECTIONTYPE PLUGIN CONNECTION "hostname,port:xxx,database,username,password" PLUGIN "C:/ms4w/Apache/specialplugins/msplugin_sde_92.dll" DATA "layername,geometrycolumn,SDE.DEFAULT" .. index:: pair: LAYER; POSTLABELCACHE POSTLABELCACHE [true|false] Tells MapServer to render this layer after all labels in the cache have been drawn. Useful for adding neatlines and similar elements. Default is false. .. index:: pair: LAYER; PROCESSING .. index:: PROCESSING, Raster options, Special options PROCESSING [string] Passes a processing directive to be used with this layer. The supported processing directives vary by layer type, and the underlying driver that processes them. .. index:: triple: LAYER; PROCESSING; ITEMS - **Attributes Directive** - The ITEMS processing option allows to specify the name of attributes for inline layers or specify the subset of the attributes to be used by the layer, such as: .. code-block:: mapfile PROCESSING "ITEMS=itemname1,itemname2,itemname3" .. index:: triple: LAYER; PROCESSING; CLOSE_CONNECTION - **Connection Pooling Directive** - This is where you can enable connection pooling for certain layer layer types. Connection pooling will allow MapServer to share the handle to an open database or layer connection throughout a single map draw process. Additionally, if you have FastCGI enabled, the connection handle will stay open indefinitely, or according to the options specified in the :ref:`FastCGI ` configuration. :ref:`oci`, :ref:`arcsde`, :ref:`ogr` and :ref:`input_postgis` currently support this approach. .. code-block:: mapfile PROCESSING "CLOSE_CONNECTION=DEFER" .. index:: triple: LAYER; PROCESSING; LABEL_NO_CLIP - **Label Directive** - The LABEL_NO_CLIP processing option can be used to skip clipping of shapes when determining associated label anchor points. This avoids changes in label position as extents change between map draws. It also avoids duplicate labels where features appear in multiple adjacent tiles when creating tiled maps. .. code-block:: mapfile PROCESSING "LABEL_NO_CLIP=True" .. index:: triple: LAYER; PROCESSING; GETSHAPE_STYLE_ITEMS - **OGR Styles Directive** - This directive can be used for obtaining label styles through MapScript. For more information see the :ref:`MapServer's OGR document `. .. code-block:: mapfile PROCESSING "GETSHAPE_STYLE_ITEMS=all" .. index:: triple: LAYER; PROCESSING; raster options - **Raster Directives** - All raster processing options are described in :ref:`raster`. Here we see the SCALE and BANDs directives used to autoscale raster data and alter the band mapping. .. code-block:: mapfile PROCESSING "SCALE=AUTO" PROCESSING "BANDS=3,2,1" .. index:: pair: LAYER; PROJECTION :ref:`PROJECTION` Signals the start of a :ref:`PROJECTION` object. .. index:: pair: LAYER; REQUIRES REQUIRES [expression] Sets context for displaying this layer (see LABELREQUIRES_). .. index:: pair: LAYER; SIZEUNITS .. index:: triple: LAYER; SIZEUNITS; feet .. index:: triple: LAYER; SIZEUNITS; inches .. index:: triple: LAYER; SIZEUNITS; kilometers .. index:: triple: LAYER; SIZEUNITS; meters .. index:: triple: LAYER; SIZEUNITS; miles .. index:: triple: LAYER; SIZEUNITS; nauticalmiles .. index:: triple: LAYER; SIZEUNITS; pixels SIZEUNITS [feet|inches|kilometers|meters|miles|nauticalmiles|pixels] Sets the unit of :ref:`CLASS` object SIZE values (default is pixels). Useful for simulating buffering. `Nauticalmiles` was added in MapServer 5.6. .. index:: pair: LAYER; STATUS .. _STATUS: STATUS [on|off|default] Sets the current status of the layer. Often modified by MapServer itself. Default turns the layer on permanently. .. note:: In :ref:`CGI ` mode, layers with STATUS DEFAULT cannot be turned off using normal mechanisms. It is recommended to set layers to STATUS DEFAULT while debugging a problem, but set them back to ON/OFF in normal use. .. note:: For :ref:`WMS `, layers in the server mapfile with STATUS DEFAULT are always sent to the client. .. note:: The STATUS of the individual layers of a GROUP has no effect when the group name is present in the LAYERS parameter of a CGI request - all the layers of the group will be returned. .. index:: pair: LAYER; STYLEITEM STYLEITEM [|auto] Item to use for feature specific styling. The style information may be represented by a separate attribute (style string) attached to the feature. MapServer supports the following style string representations: - **MapServer STYLE definition** - The style string can be represented as a MapServer :ref:`STYLE` block according to the following example: .. code-block:: mapfile STYLE BACKGROUNDCOLOR 128 0 0 COLOR 0 0 208 END - **MapServer CLASS definition** - By specifying the entire :ref:`CLASS` instead of a single style allows to use further options (like setting expressions, label attributes, multiple styles) on a per feature basis. - **OGR Style String** - MapServer support rendering the OGR style string format according to the `OGR - Feature Style Specification`_ documentation. Currently only a few data sources support storing the styles along with the features (like MapInfo, AutoCAD DXF, Microstation DGN), however those styles can easily be transferred to many other data sources as a separate attribute by using the `ogr2ogr`_ command line tool as follows:: ogr2ogr -sql "select *, OGR_STYLE from srclayer" "dstlayer" "srclayer" .. index:: triple: LAYER; STYLEITEM; AUTO The value: `AUTO` can be used for automatic styling. - Automatic styling can be provided by the driver. Currently, only the OGR driver supports automatic styling. - When used for a :ref:`union`, the styles from the source layers will be used. .. index:: pair: LAYER; SYMBOLSCALEDENOM .. _SYMBOLSCALEDENOM: SYMBOLSCALEDENOM [double] The scale at which symbols and/or text appear full size. This allows for dynamic scaling of objects based on the scale of the map. If not set then this layer will always appear at the same size. Scaling only takes place within the limits of MINSIZE and MAXSIZE as described above. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000. Implemented in MapServer 5.0, to replace the deprecated SYMBOLSCALE parameter. .. seealso:: :term:`Map Scale` SYMBOLSCALE [double] - deprecated Since MapServer 5.0 the proper parameter to use is SYMBOLSCALEDENOM instead. The deprecated SYMBOLSCALE is the scale at which symbols and/or text appear full size. This allows for dynamic scaling of objects based on the scale of the map. If not set then this layer will always appear at the same size. Scaling only takes place within the limits of MINSIZE and MAXSIZE as described above. Scale is given as the denominator of the actual scale fraction, for example for a map at a scale of 1:24,000 use 24000. .. deprecated:: 5.0 .. index:: pair: LAYER; TEMPLATE :ref:`TEMPLATE