sDNA for Python enthusiasts

What is sDNA?

sDNA is Cardiff University’s in-house spatial network analysis software. Being born out of a geography department it does what geographers are supposedly best at – colouring in maps!

Actually that’s not quite true.  sDNA computes a wide variety of statistics for links within a network, and it’s up to you to convert those to colours if you so choose.  Here are some examples of what we mean by that.  They all use the road network of Cardiff – but think big, because many other kinds of spatial network exist – building interiors, rivers, power lines, communications, game levels…

Here’s a map coloured according to the parameter Angular Betweenness 600m.  This sort of statistic can correlate to flows of pedestrians in the real world.

The next map is coloured according to the parameter Angular Betweenness 4km, which tends to correlate to flows of real world vehicle traffic.  (For those of you who can spot a motorway in this map – the low traffic predicted on it is an edge effect; you’d have to model a larger area to get it right).

And finally here’s one showing Link density at 600m.

All mapping data © Crown Copyright/database right 2012. An Ordnance Survey/EDINA supplied service.

sDNA computes something like 20 different types of statistic, at customizable spatial scales and with customizable weighting and route evaluation criteria.  For more information have a look at the Friendly Guide to sDNA Outputs.  For more information on the sDNA software itself see our software page.

What is sdnapy?

sdnapy is a python wrapper for the sDNA backend, allowing you to access spatial network analysis directly from Python 2.x.  It is installed by default along with sDNA.  It provides spatial network objects in python to which you can attach arbitrary data; and calculation objects which will either modify networks or compute statistics on them.  How you display or otherwise use the resulting data is a problem we leave to you.

To get started, first download and install sDNA (it’s free).  For the canonical example of how to use sdnapy, look at the code that uses it; runcalculation.py in the sDNA program folder.