I'm developing a custom routing application using Openstreetmap. To do this I have to read (at least) the nodes and edges in a certain boundary box using an Openstreetmap API like Overpass. After that I will process the nodes and edges and apply my routing algorithm. My main problem is to determine the size of this boundary box.
One way is to read out a big boundary box including the origin and destination nodes and process all the nodes and edges in it, but this seems excessive and would take a long loading time from the API. Furthermore, this is no way to guarantee that we have all the roads needed.
Another way would be to read out a small boundary box around the origin node, start the routing algorithm (say Dijkstra) from there and read/process a new portion of the map when needed. This approach would have to make several calls to the API server and this could take time as well.
Do you know whether one of these two approaches is usual in OSM routing applications or if another approach is preferable?