I want to add start and end points to my attribute table for each feature in one layer in terms of actual location and not distance form start meter i.e. start being 0 and end point 10 meters. Is there a way I could do this?
1 Answer
Use the expressions
start_point($geometry)
and end_point($geometry)
This expression alone will result in NULL
in your attribute table. To make it readable in your attribute table combine it with geom_to_wkt()
or x()
and y()
. For example:
geom_to_wkt(start_point($geometry))
(UseText (string)
as field type) orx(start_point($geometry)) || ', ' || y(start_point($geometry))
(UseText (string)
as field type)x(start_point($geometry))
(UseDecimal number (real)
as field type)
Enter the expression in your field calculator and make sure to set output field type
correctly as well as ouput field length
and precision
:
-
It seems to not work with both expressions as NULL appears with both expression types Commented May 20, 2019 at 19:07
-
And make sure to choose the correct output field type, e.g.
Text (string)
for WKT or concatenated coordinates. Commented May 20, 2019 at 19:24 -