3

I have

  • a vector layer with a number of points which correspond to magnetic targets
  • axis retrieved from AutoCAD

The task is to project the points on the axis and then calculate the distance of each projected point from the start of the axis. Ideally, I would like the calculated distance to be on the same table as the points so I can know which point each distance refers to.

Moreover, it would be nice to know the perpendicular distance of each point from the reference axis. A picture of the above problem is also presented below.

Problem_example

1 Answer 1

4

Start the Field Calculator on your point layer's attribute table.

Create a new field by an expression below:

line_locate_point(geometry:=geometry(get_feature('NaMy_FSR', 'id', '1')), point:=$geometry)

Assuming:

  • Your line layer name is : NaMy_FSR
  • The line has an attribute value 1 in the 'id' field. (You can use any field to distinguish the line).

[EDIT]

As to the distance the perpendicular distance of each point from the reference axis;

Not sure if this works, but will you try:

distance(closest_point(geometry(get_feature(‘NaMy_FSR’, ‘id’, ‘1’)), geometry), $geometry)

[revision]

distance(closest_point(geometry(get_feature(‘NaMy_FSR’, ‘id’, ‘1’)), $geometry), $geometry)
13
  • Is there a way to obtain the projection distance from the line ?
    – Pand
    Jan 10, 2019 at 12:28
  • Hi @stamatis Yes, I think it is possible. Will you post a new question or edit your current question to include this additional requirement?
    – Kazuhito
    Jan 10, 2019 at 12:38
  • Question edited. Looking forward for the answer :)
    – Pand
    Jan 10, 2019 at 12:47
  • @stamatis Added another syntax in [EDIT] section. Hopefully it works, but other specialists at this board may help you better.
    – Kazuhito
    Jan 10, 2019 at 12:53
  • 1
    @stamatis Both questions are interesting, definitely. Will you post them as new questions? For the first one, I recommend to look into azimuth() function. I have no idea about the latter one, which would require experts' help.
    – Kazuhito
    Jan 10, 2019 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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