# sDNA - OD assignment: trip length and destination weight from network

I am trying to assign trips from one origin to several destinations in sDNA, via an O-D matrix. The aim is to find average trip lengths to these destinations based on their weight. I have used a simple matrix with one origin and two destinations.

``````list    2
zone    zone    weight
origin  dest    1
origin  dest1   2
``````

To get to the average trip length, I multiplied the betweenness value of each link with its length (LLen), and divided the sum by the total weight (3). Question 1: Is this the correct way to derive the average trip length? The results look correct.

Question 2: For the case of weighting by many destinations (for instance, commercial floor area), is there a way to pass the respective weights to the calculation directly from the network and not from an external matrix/file? I have tried

``````  list  2
zone    zone    flow
origin  dest    1
origin  dest1   1
``````

with `destweightformula = weight` with weight being a column in the network attribute table. This does not yield the desired output (flows are distributed equally between origin and both destinations). I kept flow as 1 for both, as I would like the result to be a function of network weight and not pre-assigned flows.

Edit: is integral analysis and betweenness weighted by origin and destination weight a better way to achieve results for question 2?

For your first question, the surest way is to use the sDNA `Skim matrix` tool which automatically computes average trip length for each zone pair. If you want to combine this for all trips in the analysis, then take a weighted mean based on the weight (also calculated for each zone pair by skim matrix).

The way you were trying to do it (betweenness * length / total weight) is ingenious, I have never tried it, but it might work (assuming for total weight you mean the total weight in your OD matrix, not the total origin/destination weight on the network - not the same thing!). Alternatively there might be a gotcha I haven't thought of. If you run a larger analysis you might like to check whether that approach gives a similar result to `skim matrix`.

For your second question, it seems like (as you say) you want to use the default sDNA Integral analysis, not one based on assigning an OD matrix. sDNA at present gives you two ways of computing trip weights from origin and destination weights

1. trip weight = origin weight * destination weight; this is the default
2. trip weight = origin weight * destination weight / total destination weight within radius of origin; sDNA calls this "two phase betweenness"

(in both cases this assumes origin and destination are within radius of one another, if not, the trip weight is zero)

If you wanted trip weights based on anything other than 1 or 2 above (e.g. a gravity model) then at present you'd need to export a skim matrix to get the mean distance, compute weights yourself based on the skim matrix, then run sDNA from OD matrix to assign those weighted trips to the network.

sDNA can, however, read zonal data for origin/destination weights (and automatically distribute e.g. census population over all links within the zone, etc) from a csv table file, if you check the docs.

• If Skim matrix is run with EUC-ANG routing and analysis metric then it will output EUC-ANG distances (maybe one day I or someone else will separate the choice of routing and analysis metric). Jun 30, 2022 at 11:34
• Another alternative is to run sDNA Integral with the metric of your choice, then look at "mean geodesic length" which is calculated as a weighted mean for each origin link. You could average these over all origins (weighted by weight within radius of each origin) to get mean trip length overall. Jun 30, 2022 at 11:36
• I have experimented further on this. For my test network with two origins and two destinations (one weight = 1, another weight =1) , a) Skim Matrix, b) (OD-Weighted Betweenness * LLen/total destination weight) and c) MEDn yield all identical results. Would MEDn not be what I was looking for in my original question? For the Skim Matrix, I multiply the mean distances by destination weight, sum the "weighted" distances to destinations 1 and 2 for each origin, and divide by this sum total destination weight. Again, this yields the same result as MEDn.
– SPet
Aug 25, 2022 at 8:13
• MEDn is indeed the average trip distance to/from each link for trips that take the shortest Euclidean network route ie. When using Euclidean analysis metric. If using another metric (shortest angular, cycling, etc) you can get this instead from mean geodesic length MGL. Sep 1, 2022 at 0:15
• Glad your numbers check out, though! Sep 1, 2022 at 0:18