I want to send a max speed limit request to the api at 2 second intervals for api to reform the max speed limit at the location.
I also need to ensure the max speed limit returned relates to the road being actually driven on no
- parallel road
- over / underpass road
- intersecting road
I able to send direction being travelled as well as the location co ordinates
Can anyone assist in the format of the api URL call I need to use
I doubt that any existing API can do all that. You could use the Overpass API to query all highways in square (for example 20 m/yards) around your current location, but determining which way you are actually on you’ll have to do yourself.
There are more things you need to watch out for:
If you are on a long straight road the closest node on may not be inside the square you query, so that the result will not contain the way you are on. The only way to avoid that is to get a larger square, but that will slow down the query.
You need to find out, if querying every two seconds is not overloading the server and covered by it’s terms of service, especially if you don’t only want to do this for yourself privately, but want to do this in an app that will be used by multiple people. In that case you’ll probably need your own server (or pay for it).
BTW, you may not need to query every 2 seconds. Once you have found the way you are on, you could wait until you actually leave that way (and check if you are now on another way that you previously downloaded) before execution a new query
Irrespective of whether there’s an API call that does what you want, sending continuous requests to any free API every 2 seconds will get you banhammered. If you need that sort of service level, you need to look for commercial providers, or set up your own service.