Simple route API
Jump to navigation
Jump to search
Rest API for Routing. There is currently (January, 2011) NO routing engine supporting this format. Fehl free to edit.
Use Cases
- The user gives start and end coordinates and gets a path displayed on screen.
- The navi displays the current speed limit
- The user is able to give feedback about traffic jam, road conditions,...
- The navi gives instructions like "in 200m turn left" (the 200m are by road not beeline).
- The navi calculates new direction if the driver is on the wrong road
- The navi displays the name of the road at current position
Request
http://yourmaschine.tld:port/route&48.370197&16.2890444&48.248167&15.2175
Response
<route>
<description>
<routingEngine>routed</routingEngine>
<coordinates>
<from lat="45.2" lon"="16.276"/>
<to lat="45.23" lon"="17.37"/>
</coordinates>
</description>
<instructions>
<way osmid="44838383" maxspeed="30">34.23,45.23 67.34,43.34 ...</way>
<node osmid="3332223">
<instruction arc="34.3">Turn left</instruction>
</node>
<way osmid="54938183">34.23,45.23 67.34,43.34 ....</way>
....
</instructions>
</route>
Here is a similar suggestion, which should be easier to implement in a real-time setting, because it saves much space and memory lookups. Geometry of a route is seperated from any driving instructions:
<route>
<description>
<routingEngine>routed</routingEngine>
<coordinates>
16.28908,48.370360 16.28982,48.37016 16.29173,48.36960 16.29321,48.36906 ...
</coordinates>
</description>
<instructions>
<instruct>
<at>16.29173,48.36960</at>
<text>Turn Left and follow Shoreline Avenue for 1600 meters</text>
</instruct>
</instructions>
</route>
It would make sense in a web-service to refrain from using any node/way ids because it is a moving target. Preprocessing for any decent routing engine takes time and update cycles may be several days to a few weeks.
relax NG
<element name="route" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<element name="description">
<element name="routingEngine">
<data type="string"/>
</element>
<element name="coordinates">
<element name="from">
<attribute name="lat">
<data type="double"/>
</attribute>
<attribute name="lon">
<data type="double"/>
</attribute>
</element>
<element name="to">
<attribute name="lat">
<data type="double"/>
</attribute>
<attribute name="lon">
<data type="double"/>
</attribute>
</element>
</element>
</element>
<element name="instructions">
<zeroOrMore>
<choice>
<element name="way">
<attribute name="osmid"/>
<optional>
<attribute name="maxspeed"/>
</optional>
<data type="string"/>
</element>
<element name="node">
<attribute name="osmid"/>
<element name="instruction">
<optional>
<attribute name="arc"/>
</optional>
<data type="string"/>
</element>
</element>
</choice>
</zeroOrMore>
</element>
</element>