Trying to retrieve road speed limit from drivers current location - openstreetmap

I am trying to retrieve current speed limit of a given road location data is passed to the Open Street Maps api every 2-3 seconds as the vehicle is in motion.
I have tried the code below using [around] however it only outputs results when the radius is at least 2500 metres
i am seeking to have a an area that is closer to 10 meters to determine the current speed limit of the vehicles location.
If there is an alternative endpoint to achieve the above so that is more robust and responsive please advise
i am basically wanting to replicate what i see on navigation apps where the speed limit value updates within 1-2 seconds of a vehicle passing a new speed sign of value different to the previous speed zone being driven in
I would appreciate any assistance to resolve this issue.
https://lz4.overpass-api.de/api/interpreter?
data=[out:json];nodemaxspeed;out%20meta;

Related

How to measure change in altitude at high frequency with Apple Watch

I am trying to measure changes in altitude with an Apple Watch in a sport activity (Kite Surfing). Currently my App is just collecting data for analysis. I am recording barometric and GPS altitude for comparison at a frequency of 10 measurements per second. Basically, it works and data is recorded, but it seems these data are just worthless. In both measurements there are sudden jumps in the dataset of up to +-10m and spikes in GPS readings of up to 75m. Does anyone have an idea how to get somehow accurate readings? I basically do not care about absolute altitude; I am just interested in the change of altitude.
Use startRelativeAltitudeUpdates(to:withHandler:) and when your done remember to stopRelativeAltitudeUpdates()
Here is a link to doc.
Also you can ignore anomalies. for example: if the max possible change in altitude in 100 milliseconds is 2 meters (72 km/h). Then if you see any changes more than 2 meters in 100 millisecond just ignore the data and wait for the next reading.
remember when you ignore one reading to account for the time difference.

How to get maxspeed from overpass for multilevel intersections/roads?

How can I get speed limit for multilevel intersections/roads? When I go over the bridge or under the bridge, I can get wrong speed limit.
I am using: way[maxspeed](around:20, <latitude>, <longitude>), but I cannot specific altitude.
I am using Overpass API by OpenStreetMaps.
Unfortunately, your current approach of considering speed limits of any road within a certain radius around your location is likely to struggle not just at multilevel intersections, but also with parallel roads and at regular intersections involving ways with different speed limits. It assumes that you know your location with an accuracy that you won't have available in many use cases, and fails in 3 dimensions because OpenStreetMap data does not contain altitude information, only a vertical ordering (i.e. whether an object is above or below another).
It seems to me that the problem you need to solve is finding out which road you're actually on. Once you know the road, you can easily access any of its attributes, including those relevant to speed limits.
This problem of finding the corresponding road for a location, and preferably a history of past locations, is called map matching. For OpenStreetMap data, I believe GraphHopper offers a map matching implementation and API.

Fetch walking distance on HealthKit by splits

I am working on an app that uses HealthKit framework to pull data and display it to the user. I have been able to check how many meters has the user walked in a given HKWorkoutSession, by creating a HKStatisticsQuery.
Now, I want to get more details about this data. Basically, I want to divide the total distance walked in splits of 1 km, and display how much time each of these splits took. I haven't found any solutions online to achieve this.

Driving time API other than google directions?

I have an application where I should have the driving time between a point A and a set of points. I have the GPS coordinates of all these points.
I tried to do the job using google maps directions api, but the problem is that the program must wait for a minimum of 1 second between two consecutive requests, so if the destination set contains 40 points I should wait 39 seconds before getting all the answers.
This part of the program is critical so 39 seconds will be a very long time.
Is there any other api that I can use for this?
Note that I'm not interested in detailed directions or distance, the total travel time will be enough, I can later use google directions on the best answer to get these details.
Thanks!
There's Walk Score's Travel Time API which seems to offer just that
The Travel Time API rapidly calculates travel times between an origin and a set of destinations. The distance calculator uses ... driving distance ...

Give wrong GPS coordinates at first time

to all i want to know why location manager in iphone gives wrong coordinate at first time when run application.Due to this my distance is come 100 meter at start of application and my average speed is also effected due to this
Each location you receive will have a horizontal accuracy. If the accuracy is above some threshold, say 10 meters, then disregard it. It will take longer to get an accurate read. A negative accuracy means unknown and should also be discarded.
You could also keep your current logic, but reset all data the first time the accuracy is below your threshold. You will still be disregarding inaccurate data, but you can give the user some initial feedback the way map programs do.
Which approach to use depends on your application.