You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/topics/FeatureInfo.md
+60-11Lines changed: 60 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,26 @@ With the `qwc-feature-info-service`, you can query features directly from a data
50
50
"template": "<div><h2>Demo Template</h2>Pos: {{ x }}, {{ y }}<br>Name: {{ feature.Name }}</div>"
51
51
}
52
52
```
53
-
*Note:*`x`, `y` and `geom` are passed as parameters to the SQL query. If a `GetFeatureInfo` request is being processed with a `filter_geom` parameter, `geom` will correspond to that parameter. Otherwise `geom` will be `POINT(x y)`.
53
+
54
+
In a DB Query the following values are replaced in the SQL:
55
+
56
+
*`:x`: X coordinate of query
57
+
*`:y`: Y coordinate of query
58
+
*`:srid`: SRID of query coordinates
59
+
*`:resolution`: Resolution in map units per pixel
60
+
*`:FI_POINT_TOLERANCE`: Tolerance for picking points, in pixels (default=16)
61
+
*`:FI_LINE_TOLERANCE`: Tolerance for picking lines, in pixels (default=8)
62
+
*`:FI_POLYGON_TOLERANCE`: Tolerance for picking polygons, in pixels (default=4)
63
+
*`:i`: X ordinate of query point on map, in pixels
64
+
*`:j`: Y ordinate of query point on map, in pixels
65
+
*`:height`: Height of map output, in pixels
66
+
*`:width`: Width of map output, in pixels
67
+
*`:bbox`: 'Bounding box for map extent as minx,miny,maxx,maxy'
68
+
*`:crs`: 'CRS for map extent'
69
+
*`:feature_count`: Max feature count
70
+
*`:with_geometry`: Whether to return geometries in response (default=1)
71
+
*`:with_maptip`: Whether to return maptip in response (default=1)
72
+
*`:geom`: The `filter_geom` passed to the `GetFeatureInfo` request, if any, otherwise `POINT(x y)`
54
73
55
74
### Attribute values: HTML markup, hyperlinks, images
56
75
@@ -154,19 +173,49 @@ Example `info_template` with template path:
154
173
}
155
174
```
156
175
157
-
*Note:*
176
+
The template must only contain the body content (without `head`, `script`, `body`).
158
177
159
-
- `x`and `y` are the info query coordinates. `feature.<attr>` renders the `attr` attribute value of the feature.
160
-
- The templates must be HTML fragments *without* `html` or `body` tags.
161
-
- The templates folder needs to be mounted into the `qwc-feature-info-service` container, i.e.:
* `geometry`: Feature geometry as WKT (if present)
190
+
* `layer`: Layer name
191
+
192
+
To automatically detect hyperlinks in values and replace them as HTML links as well as transform image URLs to inline images the following helper can be used in the template:
193
+
194
+
render_value(value)
195
+
196
+
When using [localized themes](./Translations.md#translated-themes), if you want to make QWC translate the attribute names, enclose these in `translate()`.
197
+
198
+
Example:
199
+
200
+
```xml
201
+
<div>Result at coordinates {{ x }}, {{ y }}</div>
202
+
<table>
203
+
<tr>
204
+
<td>translate(Name):</td>
205
+
<td>{{ feature.name }}</td>
206
+
</tr>
207
+
<tr>
208
+
<td>translate(Description):</td>
209
+
<td>{{ feature.description }}</td>
210
+
</tr>
211
+
<tr>
212
+
<td>translate(Link):</td>
213
+
<td>{{ render_value(feature.link) }}</td>
214
+
</tr>
215
+
</table>
168
216
```
169
217
218
+
170
219
### Localization
171
220
172
221
The `qwc-feature-info-service` supports switching the runtime locale by setting the `LOCALE` environment variable, i.e.:
Copy file name to clipboardExpand all lines: src/topics/Translations.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ By default, QWC will attempt to load the translation matching your browser langu
6
6
7
7
The [Settings Plugin](../references/qwc2_plugins.md#settings) furthermore allows graphically switching the language within QWC, with the list of available languages configured via the `languages` plugin configuration property.
QWC also supports localized themes, including in particular the theme name, layer and attribute names.
12
12
@@ -104,7 +104,7 @@ where `<lang>-<COUNTRY>` is a language-country code like `de-CH`.
104
104
The service will then check if `myfile_<lang>-<COUNTRY>.ext` or `myfile_<lang>.ext` exist, returning the first possible match, falling back to `myfile.ext` if neither exists.
105
105
106
106
107
-
### Adding and modifying Viewer translations
107
+
### Adding and modifying viewer translations
108
108
109
109
When working inside a `qwc-app` source folder, the translations are located at `qwc-app/static/translations`.
0 commit comments