Created
March 19, 2021 12:55
-
-
Save pigreco/f1705597c3515c21d81c64df1b46db09 to your computer and use it in GitHub Desktop.
here is the expression used in the Default widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( | |
distance( | |
overlay_nearest( | |
layer:='poligono', | |
expression:= $geometry )[0], $geometry) < | |
distance( | |
overlay_nearest( | |
layer:='linea', | |
expression:= $geometry )[0], $geometry),overlay_nearest( | |
layer:='poligono', | |
expression:= "nomePoly" )[0], | |
overlay_nearest( | |
layer:='linea', | |
expression:= "nomeLinea" )[0]) |
Author
pigreco
commented
Mar 19, 2021
•
overlay_nearest(
map_akeys(
with_variable('liv',array('linea','poligoni','edifici'),
with_variable('indice',
array_find(
array_foreach(@liv,
distance(
overlay_nearest(@element,$geometry)[0],
$geometry)),
array_sort(array_foreach(@liv,
distance(
overlay_nearest(@element,$geometry)[0],
$geometry)))[0]),
map(@liv[@indice],
array_sort(array_foreach(@liv,
distance(
overlay_nearest(@element,$geometry)[0],
$geometry)))[0])
)))[0],"name")[0]
geometry generator:
shortest_line(
overlay_nearest(layer:=
with_variable('in_layer',array('punti','line','poligono'), -- three layers
with_variable('in_dist',
array_foreach(@in_layer,distance(overlay_nearest(@element,$geometry)[0], $geometry)),
array_get(@in_layer, array_find(@in_dist, array_min(@in_dist)))))
,expression:= $geometry )[0],
$geometry)
default widgets
overlay_nearest(layer:=
with_variable('in_layer',array('punti','line','poligono'),
with_variable('in_dist',
array_foreach(@in_layer,distance(overlay_nearest(@element,$geometry)[0], $geometry)),
array_get(@in_layer, array_find(@in_dist, array_min(@in_dist)))))
,expression:= "name" )[0]
in collaboration with Giulio Fattori
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment