Skip to content

Commit

Permalink
added utfgrid documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
fdesj committed Aug 30, 2013
1 parent 5c093d8 commit f2bcfcc
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 2 deletions.
4 changes: 2 additions & 2 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class WKTLexer(RegexLexer):
r'SMALL|SQUARE|TINY|TRIANGLE|TRUE|TRUETYPE|UC|UL|UNION|UR|UV_ANGLE|UV_MINUS_ANGLE|UV_LENGTH|UV_LENGTH_2|UVRASTER|VECTOR|'
r'WFS|WMS|ALPHA|'
r'GIF|JPEG|JPG|PNG|WBMP|SWF|PDF|GTIFF|PC256|RGB|RGBA|INT16|FLOAT32|GD|'
r'AGG|CAIRO|PNG8|SVG|KML|KMZ|GDAL'
r'AGG|CAIRO|PNG8|SVG|KML|KMZ|GDAL|UTFGRID'
r')\b')

keywords = (r'(ALIGN|'
Expand All @@ -326,7 +326,7 @@ class WKTLexer(RegexLexer):
r'SHAPEPATH|SIZE|SIZEUNITS|STATUS|STYLE|STYLEITEM|SYMBOL|SYMBOLSCALE|'
r'SYMBOLSCALEDENOM|SYMBOLSET|TABLE|TEMPLATE|TEMPLATEPATTERN|TEXT|'
r'TILEINDEX|TILEITEM|TILESRS|TITLE|TO|TOLERANCE|TOLERANCEUNITS|TRANSPARENCY|'
r'TRANSPARENT|TRANSFORM|TYPE|UNITS|WEB|WIDTH|WKT|WRAP|IMAGEMODE|VALIDATION'
r'TRANSPARENT|TRANSFORM|TYPE|UNITS|UTFDATA|UTFITEM|WEB|WIDTH|WKT|WRAP|IMAGEMODE|VALIDATION'
r')\b')

class MapFileLexer(RegexLexer):
Expand Down
24 changes: 24 additions & 0 deletions en/mapfile/layer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,30 @@ UNITS [dd|feet|inches|kilometers|meters|miles|nauticalmiles|percentages|pixels]
and 1) was added in MapServer 4.10 and is mostly geared for inline
features. `nauticalmiles` was added in MapServer 5.6.

.. index::
pair: LAYER; UTFDATA

UTFDATA[expression]
Expression used by UTFGrid driver to expose data in the JSON. It needs to use JSON
valid syntax.

.. code-block:: mapfile

UTFDATA "{\"fid\":\"[fid]\",\"name\":\"[name]\"}"


.. index::
pair: LAYER; UTFITEM

UTFITEM[string]
String that is used by the UTFGrid driver as a key to each shape. When used,
the driver will look for duplicates with the same string amongst rendered shapes
and treats them as one shape instead if there's multiple occurrences.

.. code-block:: mapfile

UTFITEM "{fid}"

.. index::
pair: LAYER; VALIDATION

Expand Down
1 change: 1 addition & 0 deletions en/output/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
tile_mode
template_output
kml_output
utfgrid

83 changes: 83 additions & 0 deletions en/output/utfgrid.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
.. _utfgrid:

*****************************************************************************
UTFGrid Output
*****************************************************************************

:Author: Francois Desjarlais
:Contact: fdesjarlais1 at gmail.com
:Revision: $Revision$
:Date: $Date$
:Last Updated: 2013/08/06

.. contents:: Table of Contents
:depth: 2
:backlinks: top

Introduction
============

UTFGrid is a new output who will soon be released. This howto details the new functionalities
that this adds to map creation. This howto assumes you already now the basics of mapfile
syntax. If not, you should probably be reading :ref:`the mapfile syntax <mapfile>.

Functionnality
==============

UTFGrid output will allow greater interactions with maps by allowing data to be exposed via an
invisible UTF-8 characters grid.

Build
=====

* Iconv is necessary for the UTFGrid driver.
* AGG driver is also necessary for this driver.

Setting the OutputFormat
========================

This added in the mapfile will allow mapserver to use the UTFGrid output. In this
case, the output generated will be a grid with each pixels corresponding to a 4x4
pixels square in the original image. Also, it won't allow duplicates which means different
shapes with the same IDs will be considered as a single shape.

.. code-block:: mapfile

OUTPUTFORMAT
NAME "utfgrid"
DRIVER UTFGRID
MIMETYPE "application/json"
EXTENSION "json"
FORMATOPTION "UTFRESOLUTION=4"
FORMATOPTION "DUPLICATES=false"
END

If no FORMATOPTIONs are set, defaults values will be used. Defaults values
are: 4 for UTFRESOLUTION, true for DUPLICATES.

Exposing Feature Properties
===========================

To use UTFGrid, two new LAYER items were added. These two items allow the user
to choose which data will be exposed. To use them, add these to your layer in the
mapfile.

Exemple:

.. code-block:: mapfile

UTFITEM "id"
UTFDATA "{\"id\":\"[id]\",\"name\":\"[name]\"}"

Both items can be used separetly. If a UTFITEM is not set the sequential
id(based on rendering order) will be used as the grid keys. Using the UTFITEM won't
duplicates. If no UTFDATA is set no data beyond the UTFITEM will be exposed.

Notes
======

* UTFGrids can be set on multiple layers but only one UTFGrid can be rendered at a time. If
you wish to add multiples UTFGrid, with for example OpenLayers, you need to add new layer
for each of them.
* Due to upcoming changes to text rendering UTFGrid driver doesn't support Truetype
symbols rendering and will ignore them.

0 comments on commit f2bcfcc

Please sign in to comment.