From 4e1c9b6fa3505c96f43fb0f5984c35a2801d99bf Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 14 Aug 2024 17:19:37 +0200 Subject: [PATCH 1/4] Add RFC-139: Raster labeling (CONNECTIONTYPE RASTERLABEL) --- en/development/rfc/index.txt | 3 +- en/development/rfc/ms-rfc-139.txt | 147 ++++++++++++++++++++++++++++++ en/images/rasterlabel.png | Bin 0 -> 14990 bytes 3 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 en/development/rfc/ms-rfc-139.txt create mode 100644 en/images/rasterlabel.png diff --git a/en/development/rfc/index.txt b/en/development/rfc/index.txt index 14ce982bfe0..6f2912319b8 100644 --- a/en/development/rfc/index.txt +++ b/en/development/rfc/index.txt @@ -149,4 +149,5 @@ the project. ms-rfc-135 ms-rfc-136 ms-rfc-137 - ms-rfc-138 \ No newline at end of file + ms-rfc-138 + ms-rfc-139 diff --git a/en/development/rfc/ms-rfc-139.txt b/en/development/rfc/ms-rfc-139.txt new file mode 100644 index 00000000000..a21d3477ae1 --- /dev/null +++ b/en/development/rfc/ms-rfc-139.txt @@ -0,0 +1,147 @@ +.. _rfc139: + +========================================================================= +MS RFC 139: Raster labeling (CONNECTIONTYPE RASTERLABEL) +========================================================================= + +:Date: 2024/08/14 +:Author: Even Rouault +:Contact: even.rouault at spatialys.com +:Status: Draft +:Version: MapServer 8.4 + +1. Overview +----------- + +This is a proposal to add the ability to render labels from raster pixel values, +as an alternative or complement to other typical raster rendering (grayscale, +classification, etc.). Typical applications are for temperature, wind, humidity, +slopes, altitude, noise, pollution, etc. + +Visual example (rendered with MapServer): + + .. image:: ../../images/rasterlabel.png + +2. The proposed solution +------------------------ + +This RFC proposes the addition of a new type of layer in MapServer: +CONNECTIONTYPE RASTERLABEL. +The code is strongly based on the UVRASTER capabilities, but will be kept separate +as some likely potential evolutions of UVRASTER (such as modifying u,v values +during reprojection operations) will make both implementation diverge. + +The new type is a hybrid layer, which has a raster data source as input and +vector features as output. Only the point representation of those +vector features will be supported. Values at nodata will be ignored. + +Since the data source is a raster, all raster processing options can be +used (e.g. RESAMPLE). A default value of RESAMPLE=AVERAGE will be used, if it +is not explicitly defined. + +To render a vector field layer, we need to define a layer in the mapfile +with the following options: + + * Set the layer TYPE to POINT. + * Set CONNECTIONTYPE to RASTERLABEL. + * Set the DATA to the raster file. + * If the raster file has more than one bands, add a PROCESSING "BANDS=" option + * Specify a CLASS with a LABEL object to label the points, using the [value] + attribute binding. + +Optional "PROCESSING" settings: + + * BANDS=: Specify the band to label. Not needed if there is a single band. + * LABEL_SPACING=: The spacing is simply the distance, in pixels, between points + to be displayed in the vector field. Default is 32. + * RESAMPLE=NEAREST/AVERAGE/BILINEAR: Defaults to AVEAGE. + * ALLOW_OVERSAMPLE=YES/NO: Whether it is allowed to oversample the raster at + a resolution higher than its nominal resolution. Default is NO, meaning that + when zooming in beyond the nominal resolution of the raster, at most one + point will be generated for each source pixel. This gives to the user a sense + of the resolution of the data it displays. + +The UVRASTER layer has one attribute bindings that can be used in the layer +definition and/or class expressions: + + * [value]: the raw raster value + +Example of a layer definition: + +:: + + LAYER + NAME "temperature" + TYPE POINT + CONNECTIONTYPE RASTERLABEL + PROJECTION + "init=epsg:4326" + END + DATA data/temperature.tif + # PROCESSING "BANDS=1" + # PROCESSING "LABEL_SPACING=32" + # PROCESSING "RESAMPLE=AVERAGE" + # PROCESSING "ALLOW_OVERSAMPLE=NO" + CLASS + TEXT (tostring([value],"%.1f")+"°") + LABEL + TYPE TRUETYPE + SIZE 7 + END # label + END # class + END + + +3. Implementation Details +------------------------- + +Internally, a RASTERLABEL layer will have its own renderer/driver code. It's a +hybrid layer because it reads the raster source as a normal raster +layer does, but all other functions behave like a vector layer. The +layer can be drawn as a normal point layer using whichShape, GetShape +etc. + +Basic internal draw process of a RASTERLABEL layer: + + 1. whichShape() is called: the raster data source is read using the + internal GDAL functions, resample and all other raster options are applied + and the pixels result is stored in the internal layer structure. + + 2. getShape() is called: loop through the raster pixels and returns a + shapeObj (Point) created with the pixel location. + + 3. MapServer draws its point feature as any other vector layer. + +3.1 Files affected +------------------ + +The following files will be modified/created by this RFC: + +:: + + mapserver.h/mapfile.c (Connection type RASTERLABEL support in the mapfile) + maprasterlabel.cpp (new file for the RASTERLABEL renderer) + mapuvraster.cpp (renamed from mapuvraster.c, not strictly correlated with this development, but was the opportunity to make an optimization to make getShape() faster when requesting increasing feature index, that is also used by maprasterlabel.cpp) + maplayer.c (new layer type handling, virtual tables init etc.) + maplexer.l (add additional RASTERLABEL keyword) + +3.2 MapScript +------------- + +No issue for any MapScript bindings. The RASTERLABEL layer is handled/rendered internally as +any other layer.. + +3.4 Backwards Compatibility Issues +---------------------------------- + +This change provides a new functionality with no backwards compatibility issues being considered. + +4. Candidate implementation +--------------------------- + + * https://github.com/MapServer/MapServer/pull/7135 + +5. Voting history +----------------- + +TBD diff --git a/en/images/rasterlabel.png b/en/images/rasterlabel.png new file mode 100644 index 0000000000000000000000000000000000000000..94ac7165be13aebba715405e264add3bf7a4e099 GIT binary patch literal 14990 zcmdsec{tST|F`Ot(?-j|v6KqgDMGeUDMEO$E>U?uR6#ThDw()+N8D3ctfa=?#{2o>%}_Wbv~;7>|SJYU@V__1Ve*B8z6=g)uW?EHin9UJqw zc=6Nc&v_o&V)u)Ril(Ri;W()j82A=2Ldnz(QPn(i82GKR7XmR=@=i^$<+DB#iIkU@9~>NXb#?YQjDq+a+Cg7V_Em8T!?5D@+{m4b4I{}R& za5$XA#6SEV=j2EzDZP`1qJ7=mjOD(>Nf>Uyfq#-$^8ESpn>T;!I}d}MGBr(-x{d!B zyWTo1EX>U8evPmrJ25?-UY53Zc}?J(h5@Tec9Ad+}xT_xHqX*SX{iMGGOe(Ul+l`@^0ARp`I?r&(Du{Z=`(a(#_vS@JMNLkgjE!z=Z0zpt9v!`mdbM|R z;^N}s!-ryOhaGn%q^A#bcOU=zZA{qC?0cM>MQ1H7Egf?sCUtdu$O5u2ES(z>`wx$NG)G4R9*wj;oLZRsE>;J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17 00:00:00 2001 From: Even Rouault Date: Wed, 28 Aug 2024 14:03:39 +0200 Subject: [PATCH 2/4] Update en/development/rfc/ms-rfc-139.txt --- en/development/rfc/ms-rfc-139.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/development/rfc/ms-rfc-139.txt b/en/development/rfc/ms-rfc-139.txt index a21d3477ae1..38ef54c9eee 100644 --- a/en/development/rfc/ms-rfc-139.txt +++ b/en/development/rfc/ms-rfc-139.txt @@ -54,7 +54,7 @@ Optional "PROCESSING" settings: * BANDS=: Specify the band to label. Not needed if there is a single band. * LABEL_SPACING=: The spacing is simply the distance, in pixels, between points to be displayed in the vector field. Default is 32. - * RESAMPLE=NEAREST/AVERAGE/BILINEAR: Defaults to AVEAGE. + * RESAMPLE=NEAREST/AVERAGE/BILINEAR: Defaults to AVERAGE. * ALLOW_OVERSAMPLE=YES/NO: Whether it is allowed to oversample the raster at a resolution higher than its nominal resolution. Default is NO, meaning that when zooming in beyond the nominal resolution of the raster, at most one From ba0cad6972ba95c27471c033927ed8068246f7a7 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 3 Sep 2024 14:07:36 +0200 Subject: [PATCH 3/4] RFC 139: change status to adopted --- en/development/rfc/ms-rfc-139.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/en/development/rfc/ms-rfc-139.txt b/en/development/rfc/ms-rfc-139.txt index a21d3477ae1..8b5ba16a8dd 100644 --- a/en/development/rfc/ms-rfc-139.txt +++ b/en/development/rfc/ms-rfc-139.txt @@ -7,7 +7,7 @@ MS RFC 139: Raster labeling (CONNECTIONTYPE RASTERLABEL) :Date: 2024/08/14 :Author: Even Rouault :Contact: even.rouault at spatialys.com -:Status: Draft +:Status: Adopted :Version: MapServer 8.4 1. Overview @@ -144,4 +144,4 @@ This change provides a new functionality with no backwards compatibility issues 5. Voting history ----------------- -TBD ++1 from PSC members EvenR, TomK, JukkaR, SethG, MikeS, DanielM, JeromeB, SteveL, JeffM From b3633dff2f25ba4114d5fac5761261e1f0a1b227 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 3 Sep 2024 14:23:29 +0200 Subject: [PATCH 4/4] Add a 'Raster Labelling' section to the Raster page --- conf.py | 2 +- en/input/raster.txt | 79 ++++++++++++++++++++++++++++++++++++++++++++ en/mapfile/layer.txt | 5 ++- 3 files changed, 84 insertions(+), 2 deletions(-) diff --git a/conf.py b/conf.py index d9e07d1e3eb..d92e0f60d0a 100644 --- a/conf.py +++ b/conf.py @@ -425,7 +425,7 @@ class WKTLexer(RegexLexer): r'OPACITY|OUTLINECOLOR|OUTLINEWIDTH|OUTPUTFORMAT|OVERLAYBACKGROUNDCOLOR|' r'OVERLAYCOLOR|OVERLAYMAXSIZE|OVERLAYMINSIZE|OVERLAYOUTLINECOLOR|' r'OVERLAYSIZE|OVERLAYSYMBOL|PARTIALS|PATTERN|POINTS|POLAROFFSET|POSITION|POSTLABELCACHE|' - r'PRIORITY|PROCESSING|PROJECTION|QUERYFORMAT|QUERYMAP|REFERENCE|REGION|' + r'PRIORITY|PROCESSING|PROJECTION|QUERYFORMAT|QUERYMAP|RASTERLABEL|REFERENCE|REGION|' r'RELATIVETO|REQUIRES|RESOLUTION|SCALE|SCALEDENOM|SCALETOKEN|SHADOWCOLOR|SHADOWSIZE|' r'SHAPEPATH|SIZE|SIZEUNITS|STATUS|STYLE|STYLEITEM|SYMBOL|SYMBOLSCALE|' r'SYMBOLSCALEDENOM|SYMBOLSET|TABLE|TEMPLATE|TEMPLATEPATTERN|TEXT|' diff --git a/en/input/raster.txt b/en/input/raster.txt index 9746c56f6bd..bf2f18172f5 100644 --- a/en/input/raster.txt +++ b/en/input/raster.txt @@ -634,6 +634,85 @@ are supported in MapServer 4.0 and newer. .. index:: pair: Raster; Query +.. _rasterlabel: + +Raster Labelling +================ + +.. versionadded:: 8.4 + +This is the ability to render labels from raster pixel values, +as an alternative or complement to other typical raster rendering (grayscale, +classification, etc.). Typical applications are for temperature, wind, humidity, +slopes, altitude, noise, pollution, etc. + +Visual example: + + .. image:: ../images/rasterlabel.png + +LAYER Description +----------------- + +A raster labelling layer :ref:`LAYER` is a hybrid layer, which has a raster data +source as input and vector features as output. The output features +are represented as points. Queries are not supported. + +Since the data source is a raster, all raster processing options can +be used (e.g. RESAMPLE). RESAMPLE=AVERAGE generally gives a good +result, and the default. This can be overridden by explicitly +specifying the type of resampling. + +Vector field layers are of `TYPE` `point`, and have `CONNECTIONTYPE` +`rasterlabel`. The raster data set is specified in `DATA`. The band to label +is set through the `PROCESSING` `BANDS` option. + +LAYER Attributes +---------------- + +The rasterlabel connection type offers the following attribute: + +* [value]: the raw value + +Optional `PROCESSING` Settings +------------------------------ + +* `BANDS=`: Specify the band to label. Not needed if there is a single band. +* `LABEL_SPACING=`: The spacing is simply the distance, in pixels, between points + to be displayed in the vector field. Default is 32. +* `RESAMPLE=NEAREST/AVERAGE/BILINEAR`: Defaults to AVERAGE. +* `ALLOW_OVERSAMPLE=YES/NO`: Whether it is allowed to oversample the raster at + a resolution higher than its nominal resolution. Default is NO, meaning that + when zooming in beyond the nominal resolution of the raster, at most one + point will be generated for each source pixel. This gives to the user a sense + of the resolution of the data it displays. + +Example of a layer definition +----------------------------- + +.. code-block:: mapfile + + LAYER + NAME "temperature" + TYPE POINT + CONNECTIONTYPE RASTERLABEL + PROJECTION + "init=epsg:4326" + END + DATA "data/temperature.tif" + # PROCESSING "BANDS=1" + # PROCESSING "LABEL_SPACING=32" + # PROCESSING "RESAMPLE=AVERAGE" + # PROCESSING "ALLOW_OVERSAMPLE=NO" + CLASS + TEXT (tostring([value],"%.1f")+"°") + LABEL + TYPE TRUETYPE + SIZE 7 + END # label + END # class + END + + Raster Query ============ diff --git a/en/mapfile/layer.txt b/en/mapfile/layer.txt index 8b0b82f3854..c2db1f55001 100644 --- a/en/mapfile/layer.txt +++ b/en/mapfile/layer.txt @@ -194,6 +194,9 @@ CONNECTIONOPTIONS .. index:: triple: LAYER; CONNECTIONTYPE; postgis +.. index:: + triple: LAYER; CONNECTIONTYPE; rasterlabel + .. index:: triple: LAYER; CONNECTIONTYPE; sde @@ -209,7 +212,7 @@ CONNECTIONOPTIONS .. index:: triple: LAYER; CONNECTIONTYPE; wms -CONNECTIONTYPE [contour|kerneldensity|idw|local|ogr|oraclespatial|plugin|postgis|sde|union|uvraster|wfs|wms] +CONNECTIONTYPE [contour|kerneldensity|idw|local|ogr|oraclespatial|plugin|postgis|rasterlabel|sde|union|uvraster|wfs|wms] Type of connection. Default is local. See additional documentation for any other type.