carto
Version:
Mapnik Stylesheet Compiler
598 lines (496 loc) • 33.2 kB
HTML
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MML File Structure — carto documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="carto documentation" href="index.html"/>
<link rel="next" title="Mapnik API documentation" href="mapnik_api.html"/>
<link rel="prev" title="Styling Concepts" href="styling_concepts.html"/>
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> carto
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="installation_usage.html">Installation & Usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="language_elements.html">Language Elements</a></li>
<li class="toctree-l1"><a class="reference internal" href="styling_concepts.html">Styling Concepts</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">MML File Structure</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#properties-overview">Properties Overview</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#center">center</a></li>
<li class="toctree-l3"><a class="reference internal" href="#bounds">bounds</a></li>
<li class="toctree-l3"><a class="reference internal" href="#description">description</a></li>
<li class="toctree-l3"><a class="reference internal" href="#format">format</a></li>
<li class="toctree-l3"><a class="reference internal" href="#layer">Layer</a></li>
<li class="toctree-l3"><a class="reference internal" href="#maxzoom">maxzoom</a></li>
<li class="toctree-l3"><a class="reference internal" href="#metatile">metatile</a></li>
<li class="toctree-l3"><a class="reference internal" href="#minzoom">minzoom</a></li>
<li class="toctree-l3"><a class="reference internal" href="#name">name</a></li>
<li class="toctree-l3"><a class="reference internal" href="#properties">_properties</a></li>
<li class="toctree-l3"><a class="reference internal" href="#scale">scale</a></li>
<li class="toctree-l3"><a class="reference internal" href="#srs">srs</a></li>
<li class="toctree-l3"><a class="reference internal" href="#stylesheet">Stylesheet</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#layer-property">Layer property</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#class">class</a></li>
<li class="toctree-l3"><a class="reference internal" href="#datasource">Datasource</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#type">type</a></li>
<li class="toctree-l4"><a class="reference internal" href="#band-gdal-pgraster">band (gdal, pgraster)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#dbname-postgis-pgraster">dbname (postgis, pgraster)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#encoding-ogr-postgis-shape">encoding (ogr, postgis, shape)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#extent-ogr-postgis-pgraster">extent (ogr, postgis, pgraster)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#file-gdal-ogr-osm-raster-shape">file (gdal, ogr, osm, raster, shape)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#geometry-field-postgis">geometry_field (postgis)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#host-postgis-pgraster">host (postgis, pgraster)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#layer-ogr">layer (ogr)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#layer-by-index-ogr">layer_by_index (ogr)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#layer-by-sql-ogr">layer_by_sql (ogr)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#password-postgis-pgraster">password (postgis, pgraster)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#port-postgis-pgraster">port (postgis, pgraster)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#raster-field-pgraster">raster_field (pgraster)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#simplify-geometries-postgis">simplify_geometries (postgis)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#table-postgis-pgraster">table (postgis, pgraster)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#user-postgis-pgraster">user (postgis, pgraster)</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#extent">extent</a></li>
<li class="toctree-l3"><a class="reference internal" href="#geometry">geometry</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id">id</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id1">properties</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#abstract">abstract</a></li>
<li class="toctree-l4"><a class="reference internal" href="#group-by">group-by</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id2">maxzoom</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id3">minzoom</a></li>
<li class="toctree-l4"><a class="reference internal" href="#status">status</a></li>
<li class="toctree-l4"><a class="reference internal" href="#title">title</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#id4">srs</a></li>
<li class="toctree-l3"><a class="reference internal" href="#srs-name">srs-name</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#stylesheet-property">Stylesheet property</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#referencing-style-files">Referencing style files</a></li>
<li class="toctree-l3"><a class="reference internal" href="#specifying-style-objects">Specifying style objects</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id8">id</a></li>
<li class="toctree-l4"><a class="reference internal" href="#data">data</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="mapnik_api.html">Mapnik API documentation</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">carto</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li>MML File Structure</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/mml.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="mml-file-structure">
<h1>MML File Structure<a class="headerlink" href="#mml-file-structure" title="Permalink to this headline">¶</a></h1>
<p>The MML File (we call it like that here because of its file extension .mml) is a
<a class="reference external" href="https://en.wikipedia.org/wiki/YAML">YAML</a> or <a class="reference external" href="https://en.wikipedia.org/wiki/JSON">JSON</a>
file containing layer definitions and stylesheet references. Thus, it is the central
part of a CartoCSS stylesheet. If you generate Mapnik XML from a stylesheet this is
the file you feed to carto and from which and its references the XML is produced.</p>
<p>If you wonder whether you should use YAML or JSON here is a bit of advice. Internally,
JSON is used because it is a language that is easy to understand for machines.
YAML is a superset of JSON and is easier to read and write for humans and is also
less verbose. If you edit a stylesheet collaboratively and use version control
YAML might make it easier to resolve version conflicts. But carto understands both
forms.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">YAML makes it less tedious to specify repeating properties like database
infos for PostGIS datasources or extents by using a language feature called
<a class="reference external" href="http://www.yaml.org/spec/1.2/spec.html#id2785586">anchors or aliases</a>.</p>
</div>
<div class="section" id="properties-overview">
<h2>Properties Overview<a class="headerlink" href="#properties-overview" title="Permalink to this headline">¶</a></h2>
<p>What follows is an overview over properties a MML file can have. Simple ones are described
here while more complex ones get their own section.</p>
<div class="section" id="center">
<h3>center<a class="headerlink" href="#center" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">Array</span></code></p>
<p>Specifies the center coordinates and zoom level of the map. Longitude, latitude and
zoom level in that order. Example (WGS84): <code class="docutils literal"><span class="pre">[-1.28398,</span> <span class="pre">47.08997,</span> <span class="pre">17]</span></code></p>
</div>
<div class="section" id="bounds">
<h3>bounds<a class="headerlink" href="#bounds" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">Array</span></code></p>
<p>Defines a bounding box of the map extent. Lower left coordinates (longitude, latitude)
and upper right coordinates (longitude, latitude) in that order.
Example (WGS84): <code class="docutils literal"><span class="pre">[-179,</span> <span class="pre">-80,</span> <span class="pre">179,</span> <span class="pre">80]</span></code></p>
</div>
<div class="section" id="description">
<h3>description<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>A description for the stylesheet (usually a bit longer than the name)</p>
</div>
<div class="section" id="format">
<h3>format<a class="headerlink" href="#format" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">Keyword</span></code></p>
<p>Possible values: <code class="docutils literal"><span class="pre">png,</span> <span class="pre">jpeg,</span> <span class="pre">tiff,</span> <span class="pre">webp</span></code></p>
<p>Specifies the output format Mapnik should use. For more details see the <a class="reference external" href="https://github.com/mapnik/mapnik/wiki/Image-IO">Mapnik wiki
page on Image IO</a>.</p>
</div>
<div class="section" id="layer">
<h3>Layer<a class="headerlink" href="#layer" title="Permalink to this headline">¶</a></h3>
<p>Lists all layers in the project (see <a class="reference internal" href="#layer-reference"><span class="std std-ref">Layer property</span></a>)</p>
</div>
<div class="section" id="maxzoom">
<h3>maxzoom<a class="headerlink" href="#maxzoom" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">Integer</span></code></p>
<p>Specifies the maximum zoom level for the map</p>
</div>
<div class="section" id="metatile">
<h3>metatile<a class="headerlink" href="#metatile" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">Integer</span></code></p>
<p>Specifies the number of tiles that make up one side of a metatile. For example,
if the number is 2 then the metatile is 2 tiles wide and tall and consists of
4 individual tiles. For efficiency reasons Mapnik generates metatiles before
splitting them into individual tiles.</p>
</div>
<div class="section" id="minzoom">
<h3>minzoom<a class="headerlink" href="#minzoom" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">Integer</span></code></p>
<p>Specifies the minimum zoom level for the map</p>
</div>
<div class="section" id="name">
<h3>name<a class="headerlink" href="#name" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>A name for the stylesheet</p>
</div>
<div class="section" id="properties">
<h3>_properties<a class="headerlink" href="#properties" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">Object</span></code></p>
<p>This is the same as the <code class="docutils literal"><span class="pre">properties</span></code> property for layers on a global level with
a bit different structure. It is used when you do not specify the layers in the MML
itself but only reference them. This is used in vector tile styles where the style
and the data are separate.</p>
<p>Specify first the layer name and then below it specify its properties as you would
int the <code class="docutils literal"><span class="pre">properties</span></code> property of the specific layer.</p>
</div>
<div class="section" id="scale">
<h3>scale<a class="headerlink" href="#scale" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">Integer</span></code></p>
<p>Specifies pixel scaling for the output. For example, a scale of 2 means that there
are two pixels for each pixel in the output.</p>
</div>
<div class="section" id="srs">
<h3>srs<a class="headerlink" href="#srs" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>Specifies the projection used by Mapnik using the <a class="reference external" href="http://proj4.org/">PROJ.4</a>
format (SRS means <a class="reference external" href="https://en.wikipedia.org/wiki/Spatial_reference_system">Spatial reference system</a>).
The format can be determined by e.g. using <a class="reference external" href="http://spatialreference.org/">spatialreference.org</a>.</p>
</div>
<div class="section" id="stylesheet">
<h3>Stylesheet<a class="headerlink" href="#stylesheet" title="Permalink to this headline">¶</a></h3>
<p>Lists all styles or style files in the project (see <a class="reference internal" href="#stylesheet-reference"><span class="std std-ref">Stylesheet property</span></a>)</p>
</div>
</div>
<div class="section" id="layer-property">
<span id="layer-reference"></span><h2>Layer property<a class="headerlink" href="#layer-property" title="Permalink to this headline">¶</a></h2>
<p>Type: <code class="docutils literal"><span class="pre">Array</span></code></p>
<p>Within this property layer objects are referenced that are the building blocks
of the map style. The order of specification is important as it constitutes
the drawing order of layers used by Mapnik. Layers specified first are drawn first
and those specified later are drawn afterwards.</p>
<p>Layers have different properties and their data can come from different data sources
such as shape files or relational databases like PostgreSQL/PostGIS.</p>
<p>A layer object can have the following properties.</p>
<div class="section" id="class">
<h3>class<a class="headerlink" href="#class" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>One or more classes associated with this layer separated by blanks. In style selectors
a class can be referenced by <code class="docutils literal"><span class="pre">.classname</span></code> if class contains <code class="docutils literal"><span class="pre">classname</span></code>.</p>
</div>
<div class="section" id="datasource">
<h3>Datasource<a class="headerlink" href="#datasource" title="Permalink to this headline">¶</a></h3>
<p>Mapnik supports different datasources. Within this property you specify the type
of the datasource and additional properties depending on the type.</p>
<p>Not all possible configuration options for each datasource are listed here. For
further information see the page for the datasource type on the Mapnik Wiki:
e.g. <a class="reference external" href="https://github.com/mapnik/mapnik/wiki/PostGIS">PostGIS</a>,
<a class="reference external" href="https://github.com/mapnik/mapnik/wiki/PgRaster">PgRaster</a>,
<a class="reference external" href="https://github.com/mapnik/mapnik/wiki/ShapeFile">ShapeFile</a>,
<a class="reference external" href="https://github.com/mapnik/mapnik/wiki/GDAL">GDAL</a>,
<a class="reference external" href="https://github.com/mapnik/mapnik/wiki/OGR">OGR</a>,
<a class="reference external" href="https://github.com/mapnik/mapnik/wiki/OsmPlugin">OsmPlugin</a>.</p>
<div class="section" id="type">
<h4>type<a class="headerlink" href="#type" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">Keyword</span></code></p>
<p>Possible values: <code class="docutils literal"><span class="pre">shape,</span> <span class="pre">postgis,</span> <span class="pre">pgraster,</span> <span class="pre">raster,</span> <span class="pre">(gdal),</span> <span class="pre">(ogr),</span> <span class="pre">(osm)</span></code></p>
<p>Specifies the format of the data source. Types in parenthesis are <em>not build
by default</em> according to the <a class="reference external" href="https://github.com/mapnik/mapnik/wiki/XMLConfigReference#datasource">Mapnik Wiki</a>.</p>
</div>
<div class="section" id="band-gdal-pgraster">
<h4>band (gdal, pgraster)<a class="headerlink" href="#band-gdal-pgraster" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">Integer</span></code></p>
<p>With this property you can request a specific raster band index (1-based). By
specifying <cite>-1</cite> (gdal) / <cite>0</cite> (pgraster) you request to read all bands.</p>
</div>
<div class="section" id="dbname-postgis-pgraster">
<h4>dbname (postgis, pgraster)<a class="headerlink" href="#dbname-postgis-pgraster" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>Specifies the database name of the PostgreSQL database.</p>
</div>
<div class="section" id="encoding-ogr-postgis-shape">
<h4>encoding (ogr, postgis, shape)<a class="headerlink" href="#encoding-ogr-postgis-shape" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>Specifies the encoding of the database or shapefile e.g. <cite>utf-8</cite> or <cite>latin1</cite>.</p>
</div>
<div class="section" id="extent-ogr-postgis-pgraster">
<h4>extent (ogr, postgis, pgraster)<a class="headerlink" href="#extent-ogr-postgis-pgraster" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>Specifies the maximum extent of the geometries or raster data.
Lower left coordinates (longitude, latitude) and upper right coordinates
(longitude, latitude) in that order. By default this is deduced from the
metadata of the table.</p>
</div>
<div class="section" id="file-gdal-ogr-osm-raster-shape">
<h4>file (gdal, ogr, osm, raster, shape)<a class="headerlink" href="#file-gdal-ogr-osm-raster-shape" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>Path and file name.</p>
</div>
<div class="section" id="geometry-field-postgis">
<h4>geometry_field (postgis)<a class="headerlink" href="#geometry-field-postgis" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>Specifies the name of the column that contains the geometry. Normally this will
be deduced from the query but sometimes it can be necessary to specify it manually
e.g. when there is more than one column with geometry.</p>
</div>
<div class="section" id="host-postgis-pgraster">
<h4>host (postgis, pgraster)<a class="headerlink" href="#host-postgis-pgraster" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>Specifies the hostname of the PostgreSQL database.</p>
</div>
<div class="section" id="layer-ogr">
<h4>layer (ogr)<a class="headerlink" href="#layer-ogr" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>The name of the layer to display.</p>
</div>
<div class="section" id="layer-by-index-ogr">
<h4>layer_by_index (ogr)<a class="headerlink" href="#layer-by-index-ogr" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">Integer</span></code></p>
<p>The index of the layer to display (mandatory if no layer name specified).</p>
</div>
<div class="section" id="layer-by-sql-ogr">
<h4>layer_by_sql (ogr)<a class="headerlink" href="#layer-by-sql-ogr" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>SQL-Statement to execute against the OGR datasource.</p>
</div>
<div class="section" id="password-postgis-pgraster">
<h4>password (postgis, pgraster)<a class="headerlink" href="#password-postgis-pgraster" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>Specifies the password for connecting to the PostgreSQL database.</p>
</div>
<div class="section" id="port-postgis-pgraster">
<h4>port (postgis, pgraster)<a class="headerlink" href="#port-postgis-pgraster" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>Specifies the port of the PostgreSQL database.</p>
</div>
<div class="section" id="raster-field-pgraster">
<h4>raster_field (pgraster)<a class="headerlink" href="#raster-field-pgraster" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>Specifies the name of the column that contains the raster data. Normally this will
be deduced from the query but sometimes it can be necessary to specify it manually
e.g. when there is more than one column with raster data.</p>
</div>
<div class="section" id="simplify-geometries-postgis">
<h4>simplify_geometries (postgis)<a class="headerlink" href="#simplify-geometries-postgis" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">Boolean</span></code></p>
<p>Specify if input vertices should be automatically reduced or not.</p>
</div>
<div class="section" id="table-postgis-pgraster">
<h4>table (postgis, pgraster)<a class="headerlink" href="#table-postgis-pgraster" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>Either the name of the table to fetch or a sub query <cite>(...) AS queryname</cite>.</p>
</div>
<div class="section" id="user-postgis-pgraster">
<h4>user (postgis, pgraster)<a class="headerlink" href="#user-postgis-pgraster" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>Specifies the username for connecting to the PostgreSQL database.</p>
</div>
</div>
<div class="section" id="extent">
<h3>extent<a class="headerlink" href="#extent" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">Array</span></code></p>
<p>Defines a bounding box of the layer extent. Lower left coordinates (longitude, latitude)
and upper right coordinates (longitude, latitude) in that order.
Example (WGS84): <code class="docutils literal"><span class="pre">[-179,</span> <span class="pre">-80,</span> <span class="pre">179,</span> <span class="pre">80]</span></code></p>
</div>
<div class="section" id="geometry">
<h3>geometry<a class="headerlink" href="#geometry" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">Keyword</span></code></p>
<p>Possible values: <code class="docutils literal"><span class="pre">linestring,</span> <span class="pre">point,</span> <span class="pre">polygon,</span> <span class="pre">raster</span></code></p>
<p>Specifies the geometry type for (the datasource of) this layer.</p>
</div>
<div class="section" id="id">
<h3>id<a class="headerlink" href="#id" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>A unique identifier for this layer. In style selectors it can be referenced with
<code class="docutils literal"><span class="pre">#layerid</span></code> if the id is <code class="docutils literal"><span class="pre">layerid</span></code>.</p>
</div>
<div class="section" id="id1">
<h3>properties<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">Object</span></code></p>
<p>This property basically adds any sub-property as attribute to the Mapnik layer. So
available values depend greatly on what Mapnik allows. Here is an (incomplete) list:</p>
<div class="section" id="abstract">
<h4>abstract<a class="headerlink" href="#abstract" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>A short description of this layer (typically longer than the title).</p>
</div>
<div class="section" id="group-by">
<h4>group-by<a class="headerlink" href="#group-by" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>Enables <a class="reference external" href="https://github.com/mapnik/mapnik/wiki/Grouped-rendering">grouped rendering</a>
for Mapnik by specifying the field of the datasource that should be used for grouping.
Mapnik then renders all styles of the layer for those features that have the same
value for that field before moving on to other features that have different value.</p>
</div>
<div class="section" id="id2">
<h4>maxzoom<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">Integer</span></code></p>
<p>Specifies the zoom level until which the layer is visible.</p>
</div>
<div class="section" id="id3">
<h4>minzoom<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">Integer</span></code></p>
<p>Specifies the zoom level from which the layer is visible.</p>
</div>
<div class="section" id="status">
<h4>status<a class="headerlink" href="#status" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">Integer</span></code></p>
<p>Specifies if the layer is active or not. 0 means inactive or off, 1 means
active or on.</p>
</div>
<div class="section" id="title">
<h4>title<a class="headerlink" href="#title" title="Permalink to this headline">¶</a></h4>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>The title of this layer. Probably more verbose than the ID.</p>
</div>
</div>
<div class="section" id="id4">
<h3>srs<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>Specifies the projection for this layer using the <a class="reference external" href="http://proj4.org/">PROJ.4</a>
format (SRS means <a class="reference external" href="https://en.wikipedia.org/wiki/Spatial_reference_system">Spatial reference system</a>).
The format can be determined by e.g. using <a class="reference external" href="http://spatialreference.org/">spatialreference.org</a>.</p>
</div>
<div class="section" id="srs-name">
<h3>srs-name<a class="headerlink" href="#srs-name" title="Permalink to this headline">¶</a></h3>
<p>Type: <code class="docutils literal"><span class="pre">String</span></code></p>
<p>The name of this SRS.</p>
</div>
</div>
<div class="section" id="stylesheet-property">
<span id="stylesheet-reference"></span><h2>Stylesheet property<a class="headerlink" href="#stylesheet-property" title="Permalink to this headline">¶</a></h2>
<p>Type: <code class="docutils literal"><span class="pre">Array</span></code></p>
<p>You have two options to specify the styles. Either you reference MSS files or
you specify style objects directly.</p>
<div class="section" id="referencing-style-files">
<h3>Referencing style files<a class="headerlink" href="#referencing-style-files" title="Permalink to this headline">¶</a></h3>
<p>Here you reference the style files used in an array of paths/file names. Carto
understands relative as well as absolute paths. The order of style references is
not important.</p>
</div>
<div class="section" id="specifying-style-objects">
<h3>Specifying style objects<a class="headerlink" href="#specifying-style-objects" title="Permalink to this headline">¶</a></h3>
<p>Internally style file references are transformed into style objects anyway, so you
can also specify them directly. This only makes sense if you generate them
programmatically otherwise the notation could become a bit tedious. You specify
an array of style objects. The order of the objects is not important.</p>
<p>A style object consists of the following properties.</p>
<div class="section" id="id8">
<h4>id<a class="headerlink" href="#id8" title="Permalink to this headline">¶</a></h4>
<p>This is the identifier of the style object. When styles are being read from a
style file this is usually the file name. The property is used when generating
errors or warnings so it is advisable to set something recognizable here.</p>
</div>
<div class="section" id="data">
<h4>data<a class="headerlink" href="#data" title="Permalink to this headline">¶</a></h4>
<p>This contains the actually style in the form of a string.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="mapnik_api.html" class="btn btn-neutral float-right" title="Mapnik API documentation" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="styling_concepts.html" class="btn btn-neutral" title="Styling Concepts" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2017, Carto contributors.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>