I have some expressions for drawing tree canopy zones ultimately I want to merge the zones for trees, hedges and woodland together but for now I would be happy if I can get the following expression to work as an SQL query to generate a virtual layer. I am new to virtual layers but have managed to create a basic buffer, however when I try to build up my canopy expression the query runs but either generates nothing or points only.
This is my main expression
union(
difference(
buffer(
case
when "EvenCan" is null
then
translate(
buffer(
smooth(
make_polygon(
make_line(
Project($geometry, "n" ,Radians(0)),
Project($geometry, "e",Radians(90)),
Project($geometry, "s" ,Radians(180)),
Project($geometry, "w" ,Radians(270))
)
)
,5)
,(("n"+"e"+"s"+"w")*0.058),8)
,0 , 0 )
when "EvenCan" is not null
then buffer($geometry,"EvenCan")
END
,2)
,aggregate('Zone_2_subtractions_4e7a378a_1173_41b7_bfdd_e98a0218a2c7','collect',$geometry)
)
,aggregate('zone_2_additions_3e32c88c_f49b_4b5f_9bf5_8253da06c30e','collect',$geometry)
)
I have tried to translate the basic bit as follows but that generates an empty layer
select
make_polygon(
make_line(
ST_Project(geometry, n,Radians(0)),
ST_Project(geometry, e, Radians(90)),
ST_Project(geometry, s,Radians(180)),
ST_Project(geometry, w,Radians(270))
)
)
from
BS_TreeSurveyData_df898e14_a741_43f7_aaa8_8f268457f6d8
st_x(geometry)+e
(etc), but be careful with the distance unit of your layer CRS. (though either it is already in meters and the use ofst_project
is wrong, or it is in degrees and the use of thest_buffer
is wrong, so in any case the output is artistic only)