Get speed limits from OpenStreetMap

I am creating a mobile application that determines if someone is a good driver. The phone is located on the dashboard and collects GPS information while the user is driving. I need to determine the way if the driver monitors the speed limit, and I would like to do this through OpenStreetMap. What is the best way to get speed limits from OpenStreetMap?

+8
mobile openstreetmap
source share
3 answers

You can make a web request to get a response.
Here is one (try as a browser URL) a small block that you should be in:

www.overpass-api.de/api/xapi?*[maxspeed=*][bbox=5.6283473,50.5348043,5.6285261,50.534884] 

and the answer showing the street passing through it in front of the school:

 <node id="1312239864" lat="50.5348877" lon="5.6286790"> <tag k="highway" v="crossing"/> <tag k="traffic_calming" v="bump"/> </node> <node id="2025084665" lat="50.5345623" lon="5.6274183"> <tag k="traffic_calming" v="choker"/> </node> ... <way id="191950462"> <nd ref="2025084669"/> ... <tag k="bicycle" v="yes"/> <tag k="highway" v="secondary"/> <tag k="maxspeed" v="30"/> <tag k="name" v="Rue d'Esneux"/> <tag k="source:maxspeed" v="school zone"/> </way> 

I just left interesting material, self explanatory. For example, functions that simplify traffic, node.
A street is a path from nodes and custom tags.
maxspeed = 30 is your answer. If maxspeed is not given, the default is for highway = secondary (or = motorway ...)
All tags are described on wiki.openstreetmap.org
Using xapi . You can also use overpass api . The speed limit is limited, but you can improve it. Leave notes on the main map to provide data.

+7
source share

For anyone looking for a good modern alternative that can use both XML and json, HERE Maps ishidden gem is defiantly worth checking out, there is a free plan that gives about 100,000 requests, the API is also robust and easy to use.

https://developer.here.com/myapps/create-with-plan/10134035/10134084

Create an account, create an application, apply a lot to an API like the one below.

Get an example of a speed limit request in accordance with their documentation

http://route.st.nlp.nokia.com/routing/6.2/getlinkinfo.xml?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&waypoint=50.05564304861044,8.388891285757allatt

I am in no way affiliated with HERE Maps, just a developer looking for a good speed limit!

PS, if you really use this solution, then this answer may also be useful.

Here the REST API API - getlinkinfo returns an invalid speed limit

+4
source share

There is a maxspeed tag that is used for roads and waterways in OpenStreetMap data ( link ). OSM data itself is available in several formats. The easiest way to start is with a readable XML format that you can export directly from OpenStreetMap.org . the following is an example input for The Strand in London showing the data format and how maxspeed is expressed.

 <way id="157541665" version="1" timestamp="2012-04-05T22:32:48Z" changeset="1"/> <nd ref="1697772135"/> <nd ref="33141175"/> <nd ref="321255915"/> <nd ref="282569730"/> <tag k="highway" v="primary"/> <tag k="lanes" v="3"/> <tag k="maxspeed" v="30 mph"/> <tag k="name" v="Strand"/> <tag k="postal_code" v="EC4"/> </way> 
+2
source share

All Articles