How to find the direction of a point on a road

I’m currently implementing a reverse geocoder from scratch and am using a local PostGIS database on my machine to run all of my queries. Please note that I do not want to use an API (Overpass, Nominatim, etc.). Right now, I’m able to successfully retrieve the street name, city, and county when given a location’s longitude and latitude coordinates. My next goal is to now figure out how to find the direction of the given location.

I understand that OSM includes docs on direction (Forward & backward, left & right - OpenStreetMap Wiki), but where is this located within the OSM data itself? I only see a column for oneway (yes, no, null), highway, and tags (number of lanes, speed, etc.). To be specific, I want to know if a point on a non-oneway road is heading forward/backard and if it is on the left/right side.

I’m not an expert in OSM’s data model so take this with a grain of salt…

  • A single point doesn’t have a direction or handedness. Just a location.
  • A way is an ordered list of points.
  • Given some point, the “forward” direction from there along the way is toward the next point in the way list.

Once loaded into Postgis, usually ways have a direction. Is the following helping ?