1

I am new to QGIS and I have stumbled on this automatic way to map tree crowns using 4 points - north, east, south, west.

Most informative post was this and Solution 2 (8-vertex polygon).

The ellipse method works like a charm, but the drawn area is to vague for my purpose.

There I found code for exactly what I need:

make_polygon(make_line(
 translate($geometry,0,max("N",0.2)),
 translate($geometry,0.6*max("E",0.2),0.6*max("N",0.2)),
 translate($geometry,max("E",0.2),0),
 translate($geometry,0.6*max("E",0.2),-0.6*max("S",0.2)),
 translate($geometry,0,-max("S",0.2)),
 translate($geometry,-0.6*max("W",0.2),-0.6*max("S",0.2)),
 translate($geometry,-max("W",0.2),0), 
 translate($geometry,-0.6*max("W",0.2),0.6*max("N",0.2)),
 translate($geometry,0,max("N",0.2))))

Problem is that no matter what I try, output is still NULL. Even if I change NESW to numbers, its sill NULL. It should work, at least it has worked in the past for the person who wrote the code. Naming for NESW is correct. It was the first thing I checked.

I have a general idea how it should draw the polygon. That post was made few years ago. Has something changed?

2
  • Including some sample data might be helpful. – Babel Dec 24 '20 at 17:26
  • Thanks for all the help. I made an extreme rookie mistake with that code.... I chose wrong coordinate system. Tree points were correct, but crowns on the other had got drawn in the middle of the Atlantic ocean.... I got it all working now. – Inno Jan 12 at 19:12
3

I tested the expression you provided with a random points layer and added four fields for "N", "E", "S" and "W" with random values.

I just copied your expression without any minor change to my QGIS (point layer, add symbol layer, rendering type: geometry generator, geometry type: polygon) and everything works fine, see my screenshot. So check if you have values in your attribute table in the column for "N", "E", "S" and "W" and check on my screenshot if you filled in everything accordingly. If that does not help, include some sample data.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.