Question

Calculating distances from source points to a hotpot location via a road network

  • 3 August 2022
  • 7 replies
  • 40 views

Badge +7

Hello.

 

I need to calculate the distance in metres from a set of points to a single

hotspot location, but have it calculate the shortest distance along a line road

network (to the hotspot). I have three datasets:

 

Table 1: several 'home' locations (points)

Table 2: one hotspot 'destination' location (point)

Table 3: a road network (lines)

 

The road network layer does not contains things like no left turn, one-way, pathways, best avoided roads, dead-ends etc. etc. That's absolutely fine, as I just need a crude distance along the network.

 

Also, the home locations may or may not be on the network, so I may need to introduce a tolerance for where a point doesn’t snap to a network line.

 

I need the shortest distance added to table 1 as a new column in metres.

 

I’ve looked at ShortestPathFinder and LengthToPointCalculator but they don’t seem appropriate.

 

Many thanks,

 


7 replies

Userlevel 1
Badge +21

The ShortestPathFinder should work here, you may just need some manipulation of the data prior.

 

You'll need to find the closest point on the network to your home location, then once you have that point add an additional vertex with the destination location so you now have a from to line. (Edit: actually i think the new network snapping paramaters mean this is not necessary)

Separately, you'll need to make sure that your network has nodes where your home locations join.

The shortest path finder should then give you a path and you can use a length calculator to find the distance

image

Badge +7

The ShortestPathFinder should work here, you may just need some manipulation of the data prior.

 

You'll need to find the closest point on the network to your home location, then once you have that point add an additional vertex with the destination location so you now have a from to line. (Edit: actually i think the new network snapping paramaters mean this is not necessary)

Separately, you'll need to make sure that your network has nodes where your home locations join.

The shortest path finder should then give you a path and you can use a length calculator to find the distance

image

Thanks for that, Ebygomm, You said: “Separately, you'll need to make sure that your network has nodes where your home locations join”. OK, so let’s say I have twenty home locations, are you saying that I need to ensure they are nodes on the road network? can I assume that means that I don’t need a separate points layer of home locations? So, in this scenario I would have just two read-in layers: 1) the road network with additional nodes representing the home locations, and 2) the hotspot location. I then connect those to a ShortestPathFinder and then connect further to a LengthCalculator. Have I got right? Thanks,
Userlevel 1
Badge +21
Thanks for that, Ebygomm, You said: “Separately, you'll need to make sure that your network has nodes where your home locations join”. OK, so let’s say I have twenty home locations, are you saying that I need to ensure they are nodes on the road network? can I assume that means that I don’t need a separate points layer of home locations? So, in this scenario I would have just two read-in layers: 1) the road network with additional nodes representing the home locations, and 2) the hotspot location. I then connect those to a ShortestPathFinder and then connect further to a LengthCalculator. Have I got right? Thanks,

Not quite, I've added in a screenshot which might help

Badge +2

@scarter​ There is a Snapping parameter on the ShortestPathFinder so the 'homes' don't need to be right on the road network. But the road network itself does have to be properly noded - that means that all lines are split at junctions and are snapped. FME does not support 'complex edges' in it's topology modelling.

You can use NetworkTopologyCalculator to test the connectivity of your network. Run all your roads into the NetworkTopologyCalculator and then use an Aggregator to group by _network_id. You'll quickly see what FME thinks to be disconnected segments

Badge +7

@scarter​ There is a Snapping parameter on the ShortestPathFinder so the 'homes' don't need to be right on the road network. But the road network itself does have to be properly noded - that means that all lines are split at junctions and are snapped. FME does not support 'complex edges' in it's topology modelling.

You can use NetworkTopologyCalculator to test the connectivity of your network. Run all your roads into the NetworkTopologyCalculator and then use an Aggregator to group by _network_id. You'll quickly see what FME thinks to be disconnected segments

Thank you, Markatsafe. I certainly have some trialling and testing to do. Thanks,
Userlevel 1
Badge +21

@scarter​ There is a Snapping parameter on the ShortestPathFinder so the 'homes' don't need to be right on the road network. But the road network itself does have to be properly noded - that means that all lines are split at junctions and are snapped. FME does not support 'complex edges' in it's topology modelling.

You can use NetworkTopologyCalculator to test the connectivity of your network. Run all your roads into the NetworkTopologyCalculator and then use an Aggregator to group by _network_id. You'll quickly see what FME thinks to be disconnected segments

"There is a Snapping parameter on the ShortestPathFinder so the 'homes' don't need to be right on the road network. But the road network itself does have to be properly noded - that means that all lines are split at junctions and are snapped"

 

The homes (and destination) need to be able to snap to a junction though, don't they, for the ShortestPathFinder to work?

Userlevel 1
Badge +11

"There is a Snapping parameter on the ShortestPathFinder so the 'homes' don't need to be right on the road network. But the road network itself does have to be properly noded - that means that all lines are split at junctions and are snapped"

 

The homes (and destination) need to be able to snap to a junction though, don't they, for the ShortestPathFinder to work?

Yes, it only snaps to endpoints. FYI - FMEENGINE-15205

Reply