Solved

Move a point to a fix distance


Badge +10

Hello there

we are a series of building points in each side of the road we need to move all the points to the same distance on each side of the road

Actual Status

point_toRoad_actual 

 

Target

point_toRoad_target 

icon

Best answer by geomancer 7 June 2022, 15:58

View original

17 replies

Userlevel 2
Badge +12

An idea:

  • NeighborFinder
  • VertexCreator (add vertex)
  • LineExtenter with your distance
  • CoordinateExtractor
  • VertexCreator (replace vertex)
Userlevel 1
Badge +21

If you use the NeighborFinder you should then be able to use the attributes that are generated (distance and angle) in an offsetter in polar coordinate mode.

 

image

Userlevel 4
Badge +36

EDIT: VertexCreator is not needed, see comment by ebygomm below.

@ebygomm​ Great idea! Calculating points at a fixed distance from the line then goes like this:

Fixed_DistanceYou may want to check for points that are not projected perpendicularly onto the line.

Userlevel 1
Badge +21

EDIT: VertexCreator is not needed, see comment by ebygomm below.

@ebygomm​ Great idea! Calculating points at a fixed distance from the line then goes like this:

Fixed_DistanceYou may want to check for points that are not projected perpendicularly onto the line.

No need for the VertexCreator, you can just offset the existing points

image

Userlevel 4
Badge +36

No need for the VertexCreator, you can just offset the existing points

image

You are absolutely right, I made it too complicated.

Badge +10

EDIT: VertexCreator is not needed, see comment by ebygomm below.

@ebygomm​ Great idea! Calculating points at a fixed distance from the line then goes like this:

Fixed_DistanceYou may want to check for points that are not projected perpendicularly onto the line.

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

Userlevel 4
Badge +36

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

Nope, that was me offsetting the line vertex. ebygomm moves the original point, which results in a simpler workspace.

Badge +10

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

@geomancer​ 

sorry,

but when using only the offset it's not working since we are deducing the same value for the distance

we need a fixed distance

Please check the attached WS

Thanks

 

Userlevel 4
Badge +36

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

You are mixing my and ebygomm's ideas, with disastrous results.

ebygomm offsets the original point, using _angle. I offset the projected point on the line in the reversed direction, thus using _angle+180 .

 

I should have kept out of this one, as ebygomm's solution was good, and my 'improvements' only lead to confusion.

 

Userlevel 4
Badge +36

Note that the NeighborFinder will not give the perpendicular projected point for points whose perpendicular projection falls outside of the line segment, instead it will find the first (or last) vertex of the line. 

NeighborFinder_vs_Perpendicular

Userlevel 1
Badge +21

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

You need to offset by the distance produced by the neighborfinder minus the fixed distance value you want

 

So if your original point was 50 m away you offset by 50-20 (@Value(_distance)-20) which would move the point 30m closer to the line so it ends up being 20m away from the line

Badge +10

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

@ebygomm​ 

So sorry, I am missing something here the output value for the offset is not the same for each vertex how come they are at the same distance from the line

offset 

Userlevel 4
Badge +36

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

All points get the same distance from the line by calculating @Value(_distance)-20, as @ebygomm​ explained above. You move the point over the calculated distance towards the line (because the direction indicated by _angle is towards the line).

So when _distance is larger than your fixed distance (20 in this example) the point will be moved towards the line, and when _distance is smaller than your fixed distance, the point will be moved away from the line.

 

All credits for this solution should go to ebygomm. I apologize for muddying a perfect solution.

Badge +10

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

@ebygomm​ 

Sorry, I think I am missing something, how come the offset is different in value for each vertex but their  position to the line is the same

offset 

 

Badge +10

Note that the NeighborFinder will not give the perpendicular projected point for points whose perpendicular projection falls outside of the line segment, instead it will find the first (or last) vertex of the line. 

NeighborFinder_vs_Perpendicular

@geomancer​ 

I totally agree with you, but still I am not getting, how come the offset value is different for each vertex and on the map, they are at the same the same distance from the line , as you can see in the table view

 

 

Userlevel 4
Badge +36

Hi @boubcher​ , I was away from work for over a week, so my apologies for this late answer.

In @ebygomm​ 's solution, the offset is calculated from the original vertex, with the positive direction away from the corresponding point on the line.

Fixed_Distance_ebygomm

Badge +10

Hi @boubcher​ , I was away from work for over a week, so my apologies for this late answer.

In @ebygomm​ 's solution, the offset is calculated from the original vertex, with the positive direction away from the corresponding point on the line.

Fixed_Distance_ebygomm

@geomancer​ 

Thats fine and welcom back

Well you are right ,I don't know how I missed it

Thanks for the illustration

Reply