I\'m creating a mobile app that determines if someone if a good driver. The phone sits on the dashboard and collects GPS information while the user is driving. I need to determi
You can make a Web request to get your answer.
Here is one (try it as a browser URL) of a small box where you're supposed to be:
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 a 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 only left the interesting stuff in, most self explanatory. For example, traffic calming features on their own node.
The street is the way made of the nodes and of its own tags.
maxspeed=30 is your answer. Should there be no maxspeed,
the default applies for highway=secondary (or =motorway ...)
All the tags are described at wiki.openstreetmap.org
That's using xapi. You may also use the overpass api.
Speed limit coverage is partial but you may improve it.
Leave Notes on the main map to provide the data.
There is a maxspeed
tag that is used to for roads and waterways in the OpenStreetMap data (link). The OSM data itself is available in a number of formats. The easiest to get started with is the human readable XML format which can be exported directly from OpenStreetMap.org. below is an example entry 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>
For any one looking for a good modern alternative which can use both XML and json,HERE Maps ishidden gem defiantly worth checking out, there is a free plan which gives around 100,000 requests, the API is also rock solid and easy to use.
https://developer.here.com/myapps/create-with-plan/10134035/10134084
Create an account, create your app, apply your lat lot to an API similar to the below.
Get the speed limit example request as per their documentation
http://route.st.nlp.nokia.com/routing/6.2/getlinkinfo.xml?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&waypoint=50.05564304861044,8.38889128575724&linkattributes=all
I am in no way affiliated with HERE Maps, just a developer looking for a good speed limit solution!
PS if you do you do use this solution, then this answer may also be of use.
Here Maps REST API - getlinkinfo returns incorrect speed limit