diff --git a/R/addGeoRaster.R b/R/addGeoRaster.R
index 2c4001e..a5b5969 100644
--- a/R/addGeoRaster.R
+++ b/R/addGeoRaster.R
@@ -441,7 +441,8 @@ imagequeryOptions <- function(className = "info legend",
type = c("mousemove", "click"),
digits = NULL,
prefix = "Layer",
- noData = "NoData Value") {
+ noData = "NoData Value",
+ suffix = "") {
type = match.arg(type)
position <- match.arg(position)
list(
@@ -450,7 +451,8 @@ imagequeryOptions <- function(className = "info legend",
type = type,
digits = digits,
prefix = prefix,
- noData = noData
+ noData = noData,
+ suffix = suffix
)
}
diff --git a/R/imagequery.R b/R/imagequery.R
index b0a1acd..d104e25 100644
--- a/R/imagequery.R
+++ b/R/imagequery.R
@@ -27,6 +27,7 @@
#' @param prefix a character string to be shown as prefix for the layerId.
#' @param className a character string to append to the control legend.
#' @param ... currently not used.
+#' @param suffix a character string to be shown as suffix for the layerId values.
#'
#' @return
#' A leaflet map object.
@@ -63,7 +64,8 @@ addImageQuery = function(map,
position = 'topright',
prefix = 'Layer',
className = "",
- ...) {
+ ...,
+ suffix = "") {
if (inherits(map, "mapview")) map = mapview2leaflet(map)
@@ -157,6 +159,7 @@ addImageQuery = function(map,
, type
, digits
, prefix
+ , suffix
)
}
diff --git a/inst/htmlwidgets/lib/georaster-for-leaflet/georaster-binding.js b/inst/htmlwidgets/lib/georaster-for-leaflet/georaster-binding.js
index 81d91e3..e02524d 100644
--- a/inst/htmlwidgets/lib/georaster-for-leaflet/georaster-binding.js
+++ b/inst/htmlwidgets/lib/georaster-for-leaflet/georaster-binding.js
@@ -20,7 +20,7 @@ function mouseHandler(map, georaster, layerId, group, eventName, options) {
val[0] = options.noData
}
if (query) {
- outputWidget.innerHTML = renderInfo(val, layerId, options.digits, options.prefix);
+ outputWidget.innerHTML = renderInfo(val, layerId, options.digits, options.prefix, options.suffix);
}
let eventInfo = $.extend({
id: layerId,
@@ -43,13 +43,13 @@ function mouseHandler(map, georaster, layerId, group, eventName, options) {
}
};
}
-function renderInfo(val, layerId, digits, prefix) {
+function renderInfo(val, layerId, digits, prefix, suffix) {
$(document.getElementById("rasterValues-" + layerId)).show();
let text = "";
if(digits === "null" || digits === null) {
- text = ""+ prefix+ " "+ layerId + ": "+ val + "";
+ text = ""+ prefix+ " "+ layerId + ": "+ val + (suffix.startsWith(" ") ? suffix : " " + suffix) + "";
} else {
- text = ""+ prefix+ " "+ layerId + ": "+ val[0].toFixed(digits)+ "";
+ text = ""+ prefix+ " "+ layerId + ": "+ val[0].toFixed(digits) + (suffix.startsWith(" ") ? suffix : " " + suffix) + "";
}
return text;
}
diff --git a/inst/htmlwidgets/lib/joda/addImageQuery-bindings.js b/inst/htmlwidgets/lib/joda/addImageQuery-bindings.js
index 44dd3c0..d842926 100644
--- a/inst/htmlwidgets/lib/joda/addImageQuery-bindings.js
+++ b/inst/htmlwidgets/lib/joda/addImageQuery-bindings.js
@@ -1,5 +1,5 @@
/* global LeafletWidget, $, L */
-LeafletWidget.methods.addImageQuery = function(layerId, bounds, type, digits, prefix) {
+LeafletWidget.methods.addImageQuery = function(layerId, bounds, type, digits, prefix, suffix) {
(function(){
var map = this;
@@ -29,7 +29,7 @@ LeafletWidget.methods.addImageQuery = function(layerId, bounds, type, digits, pr
if (!(map.layerManager.getVisibleGroups().includes(layerId))) {
visible = false;
}
- rasterPicker.pick(e, layerId, boundsarr, digits, prefix, visible);
+ rasterPicker.pick(e, layerId, boundsarr, digits, prefix, suffix, visible);
});
}).call(this);
};
diff --git a/inst/htmlwidgets/lib/joda/joda.js b/inst/htmlwidgets/lib/joda/joda.js
index e197d9f..cb300f0 100644
--- a/inst/htmlwidgets/lib/joda/joda.js
+++ b/inst/htmlwidgets/lib/joda/joda.js
@@ -28,7 +28,7 @@ rasterPicker.old = function(e, x, data) {
}
};
-rasterPicker.pick = function(event, layerId, bounds, digits, prefix, visible) {
+rasterPicker.pick = function(event, layerId, bounds, digits, prefix, suffix, visible) {
var outputWidget = this.getInfoLegend(layerId);
if (!visible) {
$(outputWidget).hide();
@@ -49,7 +49,7 @@ rasterPicker.pick = function(event, layerId, bounds, digits, prefix, visible) {
pickedLayerData[rasterHitInfo.layerId] = this.getLayerData(rasterHitInfo, event.latlng /*, event.zoom?*/);
}
// render collected hit values
- outputWidget.innerHTML = this.renderInfo(pickedLayerData, digits, prefix);
+ outputWidget.innerHTML = this.renderInfo(pickedLayerData, digits, prefix, suffix);
};
rasterPicker.getInfoLegend = function(layerId) {
@@ -116,7 +116,7 @@ rasterPicker.getLayerData = function(rasterHitInfo, latlng, zoom) {
return layerData;
};
-rasterPicker.renderInfo = function(pickedLayerData, digits, prefix) {
+rasterPicker.renderInfo = function(pickedLayerData, digits, prefix, suffix) {
var text = "";
for (var layer_key in pickedLayerData) {
var layer = pickedLayerData[layer_key];
@@ -126,9 +126,9 @@ rasterPicker.renderInfo = function(pickedLayerData, digits, prefix) {
$(document.getElementById("imageValues" + "-" + layer_key)).show();
}
if(digits === "null" || digits === null) {
- text += ""+ prefix+ " "+ layer.layerId + ": "+ layer.value+ "";
+ text += ""+ prefix+ " "+ layer.layerId + ": "+ layer.value+ (suffix.startsWith(" ") ? suffix : " " + suffix) + "";
} else {
- text += ""+ prefix+ " "+ layer.layerId + ": "+ layer.value.toFixed(digits)+ "";
+ text += ""+ prefix+ " "+ layer.layerId + ": "+ layer.value.toFixed(digits)+ (suffix.startsWith(" ") ? suffix : " " + suffix) + "";
}
}
return text;
diff --git a/man/addImageQuery.Rd b/man/addImageQuery.Rd
index 53c7b12..564e5a2 100644
--- a/man/addImageQuery.Rd
+++ b/man/addImageQuery.Rd
@@ -16,7 +16,8 @@ addImageQuery(
position = "topright",
prefix = "Layer",
className = "",
- ...
+ ...,
+ suffix = ""
)
}
\arguments{
@@ -48,6 +49,8 @@ to 'mousemove'.}
\item{className}{a character string to append to the control legend.}
\item{...}{currently not used.}
+
+\item{suffix}{a character string to be shown as suffix for the layerId values.}
}
\value{
A leaflet map object.
diff --git a/man/imagequeryOptions.Rd b/man/imagequeryOptions.Rd
index 1c64e06..9df1049 100644
--- a/man/imagequeryOptions.Rd
+++ b/man/imagequeryOptions.Rd
@@ -10,7 +10,8 @@ imagequeryOptions(
type = c("mousemove", "click"),
digits = NULL,
prefix = "Layer",
- noData = "NoData Value"
+ noData = "NoData Value",
+ suffix = ""
)
}
\arguments{
@@ -28,6 +29,8 @@ to 'mousemove'.}
\item{noData}{the text shown when the mouse is over a \verb{NoData Value} as
identified by GDAL. The default "NoData Value" will show whatever is defined by
the Geotiff metadata.}
+
+\item{suffix}{a character string to be shown as suffix for the layerId values.}
}
\description{
Imagequery options for addGeoRaster, addGeotiff and addCOG