Question

Create a line between two points if the distance is less than a criteria


Hi

 

 

I have a set of zones and a set of bus stop locations. I would like to create a line between the bus stop and the centroid of the zone if the distance between the two is 800m or less. I have created a workspace that I have uploaded here:

 

I believe the problem is happening at the point of the second vertex creator where it can't recognise the x values of the bus stops but I am not sure of the issue.

 

https://arup.sharefile.com/d-saae45a937294757b

 

 

Any help is greatly appreciated.

 

 

Regards

 

Zoe

 

 

2 replies

Userlevel 2
Badge +17
Hi Zoe,

 

 

If your purpose is to create a single line per a bus stop, which connects between the bus stop and the closest zone centroid within 800m, I think the NeighborFinder+VertexCreator is suitable.

 

 

Add a NeighborFinder to the workspace; send the bus stops to the Base port; send the zone centroids to the Candidate port; set "800" to the "Maximum Distance" parameter.

 

Connect a VertexCreator to the Matched port, and set parameters like this.

 

Mode: Add Point

 

X Value: _closest_candidate_x

 

Y Value: _closest_candidate_y

 

 

If you need to create multiple lines per a bus stop, which connect between the bus stop and every zone centroid, you can modify the data flow above.

 

- set enough large value to the "Maximum Distance" parameter,

 

- specify "Close Candidate List Name" (e.g. "_list"),

 

- insert a ListExploder between the Matched port and the VertexCreator; explode the list,

 

- change the VertexCreator parameters (not use leading underscore),

 

X Value: closest_candidate_x

 

Y Value: closest_candidate_y

 

- and then add an attribute to the features, which indicates "pass" or "fail" based on the length.

 

 

See the help docs on the transformers to learn more about their usage.

 

 

Note that the CenterPointReplacer transforms the input geometry into the center point of its bounding box. Check if the location would be fit to your required "centroid".

 

 

Takashi

 

Hi Takashi

 

 

Thankyou very much for your help. I managed to get it working and its exactly what i wanted. I have attached it above if anyone is interested.

 

 

Many thanks

Reply