gama-platform / gama.old

Main repository for developing the 1.x versions of GAMA
GNU General Public License v3.0
300 stars 99 forks source link

placing points_along a line segment: something like points_at, points_on #2098

Closed sriramab closed 7 years ago

sriramab commented 7 years ago

Hi,

I was wondering if it is possible to have an operator that places a point along a line given its location in terms of percentage of distance from a starting point of the line. For example, If I say points_along( lineID_34, list(0.3, 0.68)) : this will place a point at 30% length and another at 68% length of line 34. This list can be n number of points.

I would like to request such an operator points_along. This is useful for various transportation planning aspects and is generally referred to as linear referencing

Or is it already possible in GAMA ?

Thanks.

ptaillandier commented 7 years ago

Done. here a simple example model:

model TestPointsAlong

global { geometry line; list points; init { line <- line([{10,10},{80,80}]); points <- line points_along ([0.3, 0.5, 0.9]); } }

experiment TestPointsAlong type: gui { output { display view { graphics "line" {draw line color: #black;} graphics "points" { loop pt over: points { draw circle(1) color: #red border:#black at: pt; } } }

sriramab commented 7 years ago

Thank you Patrick. So If I have a roads species from a graph coming from a shapefile. Can I say:

road_agent_10 points_along ([0.3, 0.5, 0.9]) or road_agent_10.shape points_along ([0.3, 0.5, 0.9])

I would basically have a csv

roadID, rate1, rate2, rate3

this roadID matches with the agentID. What you suggest seems good to me. But reading from csv helps. So was wondering if I could do one of these:

road_agent_10 points_along ([0.3, 0.5, 0.9]) or road_agent_10.shape points_along ([0.3, 0.5, 0.9])

what do you suggest?

ptaillandier commented 7 years ago

Hi,

road_agent_10 points_along ([0.3, 0.5, 0.9]) or road_agent_10.shape points_along ([0.3, 0.5, 0.9]) Both should work, the first solution is better as you have less to write :) .

2017-01-17 12:13 GMT+01:00 Srirāma Bhamidipati notifications@github.com:

Thank you Patrick. So If I have a roads species from a graph coming from a shapefile. Can I say:

road_agent_10 points_along ([0.3, 0.5, 0.9]) or road_agent_10.shape points_along ([0.3, 0.5, 0.9])

I would basically have a csv

roadID, rate1, rate2, rate3

this roadID matches with the agentID. What you suggest seems good to me. But reading from csv helps. So was wondering if I could do one of these:

road_agent_10 points_along ([0.3, 0.5, 0.9]) or road_agent_10.shape points_along ([0.3, 0.5, 0.9])

what do you suggest?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/gama-platform/gama/issues/2098#issuecomment-273111968, or mute the thread https://github.com/notifications/unsubscribe-auth/ABb7HcZ2rwaj_kSDvGguVD7oPsabxxzIks5rTKJ3gaJpZM4Lkq8U .

sriramab commented 7 years ago

Thank you Patrick.