@@ -634,6 +634,85 @@ are supported in MapServer 4.0 and newer.
634634.. index::
635635 pair: Raster; Query
636636
637+ .. _rasterlabel:
638+
639+ Raster Labelling
640+ ================
641+
642+ .. versionadded:: 8.4
643+
644+ This is the ability to render labels from raster pixel values,
645+ as an alternative or complement to other typical raster rendering (grayscale,
646+ classification, etc.). Typical applications are for temperature, wind, humidity,
647+ slopes, altitude, noise, pollution, etc.
648+
649+ Visual example:
650+
651+ .. image:: ../images/rasterlabel.png
652+
653+ LAYER Description
654+ -----------------
655+
656+ A raster labelling layer :ref:`LAYER` is a hybrid layer, which has a raster data
657+ source as input and vector features as output. The output features
658+ are represented as points. Queries are not supported.
659+
660+ Since the data source is a raster, all raster processing options can
661+ be used (e.g. RESAMPLE). RESAMPLE=AVERAGE generally gives a good
662+ result, and the default. This can be overridden by explicitly
663+ specifying the type of resampling.
664+
665+ Vector field layers are of `TYPE` `point`, and have `CONNECTIONTYPE`
666+ `rasterlabel`. The raster data set is specified in `DATA`. The band to label
667+ is set through the `PROCESSING` `BANDS` option.
668+
669+ LAYER Attributes
670+ ----------------
671+
672+ The rasterlabel connection type offers the following attribute:
673+
674+ * [value]: the raw value
675+
676+ Optional `PROCESSING` Settings
677+ ------------------------------
678+
679+ * `BANDS=<num>`: Specify the band to label. Not needed if there is a single band.
680+ * `LABEL_SPACING=<num>`: The spacing is simply the distance, in pixels, between points
681+ to be displayed in the vector field. Default is 32.
682+ * `RESAMPLE=NEAREST/AVERAGE/BILINEAR`: Defaults to AVERAGE.
683+ * `ALLOW_OVERSAMPLE=YES/NO`: Whether it is allowed to oversample the raster at
684+ a resolution higher than its nominal resolution. Default is NO, meaning that
685+ when zooming in beyond the nominal resolution of the raster, at most one
686+ point will be generated for each source pixel. This gives to the user a sense
687+ of the resolution of the data it displays.
688+
689+ Example of a layer definition
690+ -----------------------------
691+
692+ .. code-block:: mapfile
693+
694+ LAYER
695+ NAME "temperature"
696+ TYPE POINT
697+ CONNECTIONTYPE RASTERLABEL
698+ PROJECTION
699+ "init=epsg:4326"
700+ END
701+ DATA "data/temperature.tif"
702+ # PROCESSING "BANDS=1"
703+ # PROCESSING "LABEL_SPACING=32"
704+ # PROCESSING "RESAMPLE=AVERAGE"
705+ # PROCESSING "ALLOW_OVERSAMPLE=NO"
706+ CLASS
707+ TEXT (tostring([value],"%.1f")+"°")
708+ LABEL
709+ TYPE TRUETYPE
710+ SIZE 7
711+ END # label
712+ END # class
713+ END
714+
715+
637716Raster Query
638717============
639718
0 commit comments