Add metacalculation on currentview

This commit is contained in:
Pieter Vander Vennet 2021-12-11 02:19:28 +01:00
parent c76b0a6340
commit 65b1891cb6
8 changed files with 85 additions and 27 deletions

View file

@ -2,7 +2,8 @@
"id": "current_view",
"description": "A meta-layer which contains one single feature, namely the BBOX of the current map view. This can be used to trigger special actions. If a popup is defined for this layer, this popup will be accessible via an extra button on screen.\n\nThe icon on the button is the default icon of the layer, but can be customized by detecting 'button=yes'.",
"source": {
"osmTags": "current_view=yes"
"osmTags": "current_view=yes",
"maxCacheAge": 0
},
"shownByDefault": false,
"title": "Current View",

View file

@ -29,6 +29,37 @@
"minzoom": 19
},
"layers": [
{
"builtin": "current_view",
"override": {
"+mapRendering": [
{
"location": ["point"],
"icon": {
"render": "./assets/themes/grb_import/robot.svg"
},
"iconSize": "15,15,center"
}
],
"calculatedTags": [
"_x='y'",
"_embedded_crab_addresses=feat.overlapWith('crab_address').length"
],
"tagRenderings": [
{
"id": "hw",
"render": "There are {_embedded_crab_addresses} adresses in view",
"mappings": [{
"if": "_embedded_crab_addresses=",
"then": "Loading..."
},{
"if": "_embedded_crab_addresses=0",
"then": "No CRAB addresses in view. Zoom in more to see them"
}]
}
]
}
},
{
"builtin": "type_node",
"override": {

View file

@ -6,5 +6,15 @@
"Pieter Vander Vennet"
],
"sources": []
},
{
"path": "robot.svg",
"license": "CC-BY 4.0 International",
"authors": [
"Font Awesome"
],
"sources": [
"https://commons.wikimedia.org/wiki/File:Font_Awesome_5_solid_robot.svg"
]
}
]

View file

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M0 256v128c0 17.7 14.3 32 32 32h32V224H32c-17.7 0-32 14.3-32 32zM464 96H352V32c0-17.7-14.3-32-32-32s-32 14.3-32 32v64H176c-44.2 0-80 35.8-80 80v272c0 35.3 28.7 64 64 64h320c35.3 0 64-28.7 64-64V176c0-44.2-35.8-80-80-80zM256 416h-64v-32h64v32zm-32-120c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm128 120h-64v-32h64v32zm96 0h-64v-32h64v32zm-32-120c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm192-72h-32v192h32c17.7 0 32-14.3 32-32V256c0-17.7-14.3-32-32-32z"/></svg>
<!--
Font Awesome Free 5.2.0 by @fontawesome - https://fontawesome.com
License - https://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
-->

After

Width:  |  Height:  |  Size: 751 B