If you want to reproduce the solution in the video, use this expression with project()
function (click the link for help to see how it works). The angle (azimuth) is expected in radians, but you can use degrees and convert it with radians()
make_polygon(
make_line (
project ($geometry, 1, radians (45)),
project ($geometry, 1, radians (90)),
project ($geometry, 1, radians (135)),
project ($geometry, 1, radians (180)),
project ($geometry, 1, radians (225)),
project ($geometry, 1, radians (270)),
project ($geometry, 1, radians (315)),
project ($geometry, 1, radians (360))
)
)
You can make it shorter by looping 8 times through the project()
function with array_foreach()
:
make_polygon(
make_line (
array_foreach (
generate_series(1,8),
project($geometry, 1, radians (45*@element))
)
)
)
Be aware:
If you try adapting an expression, be careful to copy it correctly: The expression you provided is invalid, so you must have used another expression to create your screenshot: instead of make_point
, you used project
(as in the video you shared).
A second problem: the 3rd argument is an angle (azimuth in radians), whereas the second argument is a distance. You seem to mix both values, however.
Try to understand how the expression works, what each function does. See the function help in the expression string builder that describes in detail how each function works and what kind of input it requires - alternatively, see Functions List with a detailed description of each function.
Advise: Start with a simple project()
function to see how changing the values influences the result. Then go on and add a make_line
function with two points, then add a 3rd point etc. When done, use make_polygon
.
$geometry
as argument ofmake_point
function? This makes no sense as the function expects coordinates as arguments.