<p>Some ideas:</p>

<ol>
<li>you can store those distances off-heap or on-disc via MapDB or
GraphHopper its simplistic DataAccess implementations making it RAM-independent</li>
<li>you can use float which should be only ~30MB or even short and just use the kilometers</li>
<li>you could try on demand routing, without storing, as it takes only a few ms to calculate a route. Disable instructions and calculating points makes it even twice as fast. You could even disable calculating the distance and just use path.weight - this will give you another good speedup but requires a bit lower level GraphHopper usage and is only recommended if you know what you do.</li>
</ol>

<p>Now to your question. GraphHopper uses a graph model consisting of nodes (junctions) and edges (streets connecting junctions). Still a roundabout consists of multiple nodes. But in general it should be possible to use such a 'leaving' node as 'hub-id'.</p>

<p>I see two approaches to calculate those nodes:</p>

<ul>
<li>either by running the Contraction-Hierarchy and picking the highest 1000 nodes and define them as hubs - this would be similar to what is described in the '<a href="http://arxiv.org/pdf/1302.5611.pdf" rel="nofollow">transit node routing</a>' paper</li>
<li>or you calculate routes from one city to e.g. all other cities (or just 8 geographic directions) and find the last common nodes of two routes to identify some</li>
</ul>

<p>For both approaches you'll have to digg a bit deeper into GraphHopper and you'll probably need the <a href="https://github.com/graphhopper/graphhopper/blob/master/docs/core/low-level-api.md" rel="nofollow">lower level API</a>.</p>
How does GraphHopper handle a point on a highway intersections?
<p>I have 2750 city centers in Belgium. I need to know the distances between every 2 city centers.
But that results in an matrix of 57MB, just to remember those distances (not even the routes), so that scales terribly.</p>

<p>Instead, I am looking at using Highway intersections as hubs. Basically, every city knows it's nearby cities and it's nearby hubs (= highway intersection). All hubs know the distance to each other.</p>

<p>So the distance from 1 city A to another non-nearby city B, can be calculated by the distance of <code>cityA -&gt; hubX -&gt; hubY -&gt; cityB</code>. Because most cities have typically 3 hubs nearby, I might need to look at all 9 combinations and take the shortest. But in any case it should scale better memory wise.</p>

<p>Now the problem:
<strong>Can I describe a highway intersection as a single point?</strong> Think about it: a highway consist of 2 roads (one in both direction), so a highway intersection center has 4 roads (not even counting the arms).</p>