Highway guides · Mile marker data
How do I convert GPS coordinates to a highway mile marker?
Find the recorded mile markers nearest the point, on the route the point is actually on. Then place the point between the two markers on either side. Or send the coordinates to MileCheck's /v1/locate to get the nearest recorded marker within a mile. Placing the point between two markers is a separate step.
The steps
- Load the mile marker points for the state.
- Find the nearest markers to your point.
- Pick the route. At an interchange or overpass the nearest marker can be on the road crossing above, so check the distance to the road, not just to the post.
- Find the two markers on either side and place the point between them by distance. Mile 147 and 148 with the point a third of the way along gives 147.3.
Where it goes wrong
- Two routes sharing one road, like an interstate and a US highway. Pick one and keep it.
- Divided highways with markers on each side.
- States where the numbers restart at county lines.
- Points more than a mile from any marker. Say so instead of guessing.
With the API
curl "https://api.milecheckapp.com/v1/locate?apikey=YOUR_KEY&lat=47.869&lon=-121.760"
The answer has the route, the nearest milepost, the state and the distance to it. Beyond 1 mile it returns milepost: null.
Live state DOT feeds in one format
Closures, crashes, construction, chain controls, drawbridges and border waits, plus GPS to mile marker. The test key is instant, with no email.
Questions, answered
Can I do it offline?
Yes, with the mile marker file on the device. The MileCheck app works this way.
What about Canada?
The same method works with kilometre markers. The API covers ten provinces and territories.