The datafiles for the USGS (I didn't look at the NGIA ones) contain a long/lat for each feature. Presumably you could implement distance measures based on those (which I sure are described elsewhere; distance along a sphere is a solved problem - though if memory serves, last time I looked into it, I decided it was a bit of a complicated pain in the ***...)
I hope that helps!
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.