title: Shortest path between raw geo coordinates and a node of a graph
body: <p>I have implemented a simple Dijkstra's algorithm for finding the shortest path on an .osm map with Java. </p>
  
  <p>The pathfinding in a graph which is created from an .osm file works pretty well. But in case the user's current location and/or destination is not a node of this graph (just raw coordinates) how do we 'link' those coordinates to the graph to make pathfinding work?</p>
  
  <p>The simple straightforward solution "find the nearest to the current location node and draw a straight line" doesn't seem to be realistic. What if we have a situation like on the attached picture? (UPD)
  <img src="https://i.stack.imgur.com/wG3NM.jpg" alt="enter image description here"></p>
  
  <p>The problem here is that before we start any 'smart' pathfinding algorithms (like Dijkstra's) we 'link' the current position to the graph, but it is just dumb formula (a hypotenuse from Pythagorean theorem)  of finding the nearest node in terms of geographical coordinates and this formula is not 'pathinding' - it can not take obstacles and types of nodes into account. </p>
  
  <p>To paraphrase it - how do we find the shortest path between A and B if B is a node in a graph, and A is not a node?</p>
  
  <p>Have you heard of any other solutions to this problem?</p>