I have a polyline shapefile with 166 different line features. How would one populate the attribute table with x and y values of the start and end points of each line?
Answer
You have your four columns: X-start; Y-start; X-end; Y-end. Using the field calculator for each column update using:
$x_at(0)
$x_at(-1)
$y_at(0)
$y_at(-1)
This asks for the coordinate at the start of the line (the zero) and the end of the line (the negative one). This will provide you with a decimal latitude and longitude, so ensure the columns are floats.
EDIT: Thanks to the_darkside's comments please note this won't work on multi lines, due to the multiple beginnings and ends.
No comments:
Post a Comment