Searching for the next intersection on the current street offline

Hello everyone!

I’m new to OSM and would like to know if my approach for finding the next intersection ahead is possible when doing it offline.

The goal is to get the coordinates (latitude/longitude) of the next intersection on the street I’m currently driving on. For that I have my actual position (lat/lon coordinates) and heading (w.r.t. the north-pole) at disposition.

My current approach right now is to first use my coordinates for getting the name of the street/way/trace in which I am driving; then use that name for knowing which are the next intersections on that street (to both sides); and then use the heading for knowing which direction is the one I should pay attention to.
Once I have the intersection, I would get its coordinates and continue with the program.

My questions are then, is it possible to do all of that offline, i.e. with a .osm file (or similar)?
And, do you know a better approach for getting the coordinates of the next intersection ahead?

Thanks a lot in advance!

PS. I was able to get the name of the street by using nominatim and to get all the intersections of a street by using Overpass turbo, but this solutions would need internet; or is there a way of using them offline?

Several OSM-based sat nav programs do this offline, e.g. OsmAnd, Magic Earth, maps.me
OsmAnd is open-source, (github repository), so you could investigate their code to find out how they work.

I don’t know the details, but I do know they convert raw OSM data to a propriety format.