Skip to content

Commit b3633df

Browse files
committed
Add a 'Raster Labelling' section to the Raster page
1 parent 704bae5 commit b3633df

File tree

3 files changed

+84
-2
lines changed

3 files changed

+84
-2
lines changed

conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ class WKTLexer(RegexLexer):
425425
r'OPACITY|OUTLINECOLOR|OUTLINEWIDTH|OUTPUTFORMAT|OVERLAYBACKGROUNDCOLOR|'
426426
r'OVERLAYCOLOR|OVERLAYMAXSIZE|OVERLAYMINSIZE|OVERLAYOUTLINECOLOR|'
427427
r'OVERLAYSIZE|OVERLAYSYMBOL|PARTIALS|PATTERN|POINTS|POLAROFFSET|POSITION|POSTLABELCACHE|'
428-
r'PRIORITY|PROCESSING|PROJECTION|QUERYFORMAT|QUERYMAP|REFERENCE|REGION|'
428+
r'PRIORITY|PROCESSING|PROJECTION|QUERYFORMAT|QUERYMAP|RASTERLABEL|REFERENCE|REGION|'
429429
r'RELATIVETO|REQUIRES|RESOLUTION|SCALE|SCALEDENOM|SCALETOKEN|SHADOWCOLOR|SHADOWSIZE|'
430430
r'SHAPEPATH|SIZE|SIZEUNITS|STATUS|STYLE|STYLEITEM|SYMBOL|SYMBOLSCALE|'
431431
r'SYMBOLSCALEDENOM|SYMBOLSET|TABLE|TEMPLATE|TEMPLATEPATTERN|TEXT|'

en/input/raster.txt

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
637716
Raster Query
638717
============
639718

en/mapfile/layer.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ CONNECTIONOPTIONS
194194
.. index::
195195
triple: LAYER; CONNECTIONTYPE; postgis
196196

197+
.. index::
198+
triple: LAYER; CONNECTIONTYPE; rasterlabel
199+
197200
.. index::
198201
triple: LAYER; CONNECTIONTYPE; sde
199202

@@ -209,7 +212,7 @@ CONNECTIONOPTIONS
209212
.. index::
210213
triple: LAYER; CONNECTIONTYPE; wms
211214

212-
CONNECTIONTYPE [contour|kerneldensity|idw|local|ogr|oraclespatial|plugin|postgis|sde|union|uvraster|wfs|wms]
215+
CONNECTIONTYPE [contour|kerneldensity|idw|local|ogr|oraclespatial|plugin|postgis|rasterlabel|sde|union|uvraster|wfs|wms]
213216
Type of connection. Default is local. See additional documentation for
214217
any other type.
215218

0 commit comments

Comments
 (0)