I am trying to measure distance between towns (light grey in attached screenshot) and their district capitals (light purple) along usable roads (dashed blue). I used the GRASS v.distance plugin to create the red points you see, which are the nearest points on the roads for each town or district capital. Now, I am trying to measure distance between these points along the dashed blue lines. Ideally, in the "towns" attribute table, I would have a field that shows the town's distance to the nearest district capital. I have 646 towns and 12 district capitals.
I saw this thread: Measuring distance between points along line in QGIS but the recommended answer uses a formula for calculating the distance (the field they call "interval") that doesn't seem appropriate here, because it is simply distance between sequential points along a line. The "distance to nearest hub" tool doesn't seem right, either.
For context: I am a pretty basic QGIS user, but hoping to learn to code soon so that I can graduate beyond point-and-click.