Add support for OSRM 5.0 API and new instruction types

Add support for the new API in OSRM 5.x including new icon sprites
for the new instruction types.
This commit is contained in:
Patrick Niklaus 2016-06-13 00:23:41 +02:00 committed by Tom Hughes
parent 39a34efd25
commit 311acad0c4
9 changed files with 778 additions and 132 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Before After
Before After

View file

@ -0,0 +1,573 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="520"
height="20"
viewBox="0 0 520.00001 20"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="routing-sprite.svg"
inkscape:export-filename="/home/patrick/Code/openstreetmap-website/app/assets/images/routing-sprite.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.6568542"
inkscape:cx="131.24519"
inkscape:cy="13.736603"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:showpageshadow="false"
inkscape:window-width="1920"
inkscape:window-height="1080"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
showguides="false"
inkscape:guide-bbox="true"
units="px">
<inkscape:grid
type="xygrid"
id="grid4224" />
<sodipodi:guide
position="20.000001,31"
orientation="1,0"
id="guide4226" />
<sodipodi:guide
position="40.000001,19"
orientation="1,0"
id="guide4245" />
<sodipodi:guide
position="60.000002,29"
orientation="1,0"
id="guide4299" />
<sodipodi:guide
position="80.000002,35"
orientation="1,0"
id="guide4388" />
<sodipodi:guide
position="71.000002,10"
orientation="-0.7193398,-0.69465837"
id="guide4432"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="100,15"
orientation="1,0"
id="guide4499" />
<sodipodi:guide
position="120,15"
orientation="1,0"
id="guide4578" />
<sodipodi:guide
position="140,16"
orientation="1,0"
id="guide4580" />
<sodipodi:guide
position="160,21"
orientation="1,0"
id="guide4582" />
<sodipodi:guide
position="180,15"
orientation="1,0"
id="guide4729" />
<sodipodi:guide
position="200.00001,15"
orientation="1,0"
id="guide4731" />
<sodipodi:guide
position="220.00001,11"
orientation="1,0"
id="guide4747" />
<sodipodi:guide
position="78.000002,12"
orientation="-0.70710678,0.70710678"
id="guide4212"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="240.00001,19"
orientation="1,0"
id="guide4264" />
<sodipodi:guide
position="260.00001,19"
orientation="1,0"
id="guide4266" />
<sodipodi:guide
position="280.00001,5"
orientation="1,0"
id="guide4280" />
<sodipodi:guide
position="300.00001,10"
orientation="1,0"
id="guide4297" />
<sodipodi:guide
position="320.00001,24"
orientation="1,0"
id="guide4305" />
<sodipodi:guide
position="340.00001,28"
orientation="1,0"
id="guide4335" />
<sodipodi:guide
position="360.00001,30"
orientation="1,0"
id="guide4337" />
<sodipodi:guide
position="380.00001,19"
orientation="1,0"
id="guide4376" />
<sodipodi:guide
position="400.00001,19"
orientation="1,0"
id="guide4382" />
<sodipodi:guide
position="420.00001,36"
orientation="1,0"
id="guide4394" />
<sodipodi:guide
position="440.00001,20"
orientation="1,0"
id="guide4449" />
<sodipodi:guide
position="460.00001,22"
orientation="1,0"
id="guide4451" />
<sodipodi:guide
position="480.00001,20"
orientation="1,0"
id="guide4485" />
<sodipodi:guide
position="500.00001,40"
orientation="1,0"
id="guide4487" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1032.3622)">
<image
y="1002.3622"
x="1.7763568e-15"
id="image4217"
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWgAAAAUCAMAAACXrFfpAAABOFBMVEUAAAB/f39/f39/f39/f396 enoAAAB7e3t7e3t4eHh5eXl5eXl6enp3d3d4eHgAAAB3d3d1dXVzc3MAAABwcHBvb29ubm4AAABt bW1sbGxsbGxsbGxra2tra2toaGhoaGhqamoAAABmZmZoaGgAAABnZ2dkZGQAAABiYmJXV1dXV1cA AAAAAABMTEwAAAAAAABDQ0MAAAA1NTU1NTUxMTEAAAAxMTEAAAAAAAAmJiYlJSUkJCQjIyMiIiIA AAAcHBwAAAAAAAAAAAAAAAAUFBQAAAAAAAAQEBAPDw8AAAAPDw8AAAAAAAANDQ0MDAwAAAAAAAAM DAwKCgoAAAAAAAAICAgICAgAAAAHBwcAAAAHBwcGBgYAAAAAAAAAAAAAAAADAwMAAAAAAAAAAAAA AAAAAAAAAAAAAABULW3yAAAAZ3RSTlMAAQIGCw4QEBIUFhcZGh0gICItMDQ5PEBAQUJERUZHSEhK SkxMTU9QUFZXWGBgZGZpcHl6f4CAiJCRk5SXmaCmrLC1uLzAxMXIyMrM0NDT09TU29zg4OLk5ebm 6fDx8/T09vf4+/z9ttm2NwAABH9JREFUeF7tV+9zFTUUzQOMFZUAiwZbkB9bXYEU3UI0FVhcNQVx rQpbsBopFuX8//+BMy/vvd3k7mRnio8PHc/HOyc35545yWbZkYOQtKYSvDeOgg/Xs4JR8OI/kDnc Q6jX02wqqtZlKR7tN47MWtNfOMRZOZ/n+fmVuNwMD6hRhDmQSlcNXCCpJAKVtbYiRnIViAVspQsp w9Wo0+OmNXMHQWeoUjzabxwSsP1mNDMn1/KHAB7ma+9EK9uhfi1CPdxgijJMggtjnzWeZViSVnmW jqaF0yyBtGYNVNRTiEEe7Xc4oxXtxS78Co+fVoO6BSTpZgEgKt78GyCCHGxvFN5iBh12a6kD+OsK C2EBtCqR6pRm8SdI0QCwMQ8AsvF+FGLA6HkcpV64cOwz5B7Iw3B492gsXVgtp0XVXRFTPANQyX5S jSya/iyyBvDMs1WfCFeQrNGqrOFqyRjRTL0CGh7SDnAANcQb7Uf3FS01ugRQe+kL6uRT5Jfu/nb3 UmR04++DENmTOAu8jszXmKMbUMxa8WZxPHmDHnSQK8AQo1+uswDKExUb0VyUN4B1VQSBLixspnnI W/c82m9k3woqMtofTMjI6E9waxfA7i3kE5IiQcYLjc5aAO0VmCGj3fzclPOsyO48CO0GjGa1KxyA RgRG/wPU8UH3EGxM8w3gJovQ4BdvM+Wl+9F9BdDGRvvwtbxv9MnVTcyxufruwkBX/Qh8VTfkCq2t DZ4JQM1ZkwXfFCnlE7guMvUiFw5YULl2aKSUVd9oVTHRRPeTdp8DCEMJdNlPajYziXE6XMEor2Is 3Y/ua19iX4dGq9YAKJuqb/SFB+jwYG2RmNmHQPDoUeA4r8NLrAzf/3pqm0AtyDeFfF2EhfArupKc jdM3WjILOHKjzo5XUrMGtrcBE8Zl77s9H0rKS/aj+4pCY12FRgvGpgOIvtFn76HDvbPpL64F1HQ9 edPERpeK0ValySywrqquQ1lGRnuERnN/ZAeNrkdeCQ5qKrNnVjk91DUqwisATvsl9/VeclNIwApT BAPw5gd8Y33L41efYo6nV48nRJNSyujhdRYHwD6K0RUA0pUSM5RpgZk/CE2/rOGPuiUPZs8j/ZL7 +tAW2Aeew0ZyZe+ZdeY25rh9hi3XaOH8RXhYo+nDvB1JIPcZbUOjDWNMBcqF/7N1yGi/9L7eaP/9 cyKWa7tpJznmyCdLNdp7CscPazR90zfZiEDWoBa8ggtFl0y68DC0nteO9aP7ash5hjSRK3tfgouP XuHF9y/w6tFFtmyjufNqDmd0iELrgrFRYzBFwKww8BPT8Ui/9L7KZrMpHKdyy0WgT63lG1vX8+tb G/naqcmSjWYajr+e0RRpzdm3wM9RUe/hueGUt50cOA3uoFNyz23uPL6zcf+P+xt3Hu9snluC0ZEc zZZvdKxRUp5lKR7tNw7jeEpujp3Z1YHd35Ev22hmxFE1Wpik3MubH324sXXtg2tff7H68ZeX2dFD Zm1G0mdNgrcUrLw/YW+dPsFOnH6bHXtvhb0p/I9/AQmEF7Y+Eo3CAAAAAElFTkSuQmCC "
preserveAspectRatio="none"
height="20.000017"
width="360" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 9,1039.3309 3.6e-5,10.0313 1.999964,0 -3.5e-5,-10.0313 z"
id="path4446"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4448"
d="m 15,1039.3466 -5,-4.9844 -5,5 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 87.125,4.984375 87.125,5 86,5 86,12.005859 82,12 l 5,5 5,-4.984375 -4,-0.0059 0,-5.025391 7,0 L 95,17 l 2,0 0,-12 -0.46875,0 0,-0.015625 -9.40625,0 z"
transform="translate(0,1032.3622)"
id="path4509"
inkscape:connector-curvature="0" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 28,3.9882812 2.814453,2.8203126 -4.777344,4.7460942 0,0.04297 -0.03711,0 L 26,17 28,17 28,12.423828 32.228516,8.2226562 35,11 35,4 28,3.9882812 Z"
transform="translate(0,1032.3622)"
id="path4450"
inkscape:connector-curvature="0" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 53,4 0.0059,3.984375 -6.005859,0 0,2 L 47,17 l 2,0 0,-7.015625 4.009766,0 L 53.015625,14 58,9 53,4 Z"
transform="translate(0,1032.3622)"
id="path4208"
inkscape:connector-curvature="0" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 67.025391,4.4101562 67.003906,17 l 2,0 0,-7.5527344 3.685547,3.8710934 -2.683114,2.694508 6.989812,0.05505 0.01101,-7.0846724 -2.854816,2.9210504 z"
transform="translate(0,1032.3622)"
id="path4424"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccc" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 170,1035.3622 -4,5 3,0 0,5 2,0 0,-5 3,0 z"
id="path4735"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
<g
id="g4237">
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 189,1039.3309 4e-5,10.0313 1.99996,0 -3e-5,-10.0313 z"
id="path4233"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4235"
d="m 195,1039.3466 -5,-4.9844 -5,5 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<path
id="path4221"
d="m 112.00001,1036.3505 -2.81445,2.8203 4.77734,4.7461 0,0.043 0.0371,0 0,5.4023 -2,0 0,-4.5762 -4.22852,-4.2011 -2.77148,2.7773 0,-7 7,-0.012 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
id="path4223"
d="m 128.00028,1036.3622 -0.006,3.9844 6.00586,0 0,2 0,7.0156 -2,0 0,-7.0156 -4.00977,0 -0.006,4.0156 -4.98437,-5 5,-5 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="cccccccccc"
inkscape:connector-curvature="0"
id="path4225"
d="m 153.98575,1036.7724 0.0215,12.5898 -2,0 0,-7.5527 -3.68555,3.8711 2.68312,2.6945 -6.98982,0.055 -0.011,-7.0847 2.85482,2.9211 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<g
id="g4254"
transform="translate(-2.0000461,0)">
<circle
r="3"
transform="scale(1,-1)"
cy="-1044.3622"
cx="210.04105"
id="path4231"
style="opacity:1;fill:none;fill-opacity:0.43824702;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
id="path4247"
transform="translate(0,1032.3622)"
d="m 211,3.9882812 2.81445,2.8203126 -1.76562,1.7539062 c 0.58436,0.3442274 1.07073,0.8277607 1.41797,1.4101562 l 1.76172,-1.75 L 218,11 218,4 211,3.9882812 Z M 209,15.84375 209,17 l 2,0 0,-1.130859 C 210.69097,15.946541 210.3729,16 210.04102,16 209.67912,16 209.3342,15.935262 209,15.84375 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
inkscape:connector-curvature="0" />
</g>
<g
transform="translate(17.999954,0)"
id="g4258">
<circle
style="opacity:1;fill:none;fill-opacity:0.43824702;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="circle4260"
cx="210.04105"
cy="-1044.3622"
transform="scale(1,-1)"
r="3" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 211,3.9882812 2.81445,2.8203126 -1.76562,1.7539062 c 0.58436,0.3442274 1.07073,0.8277607 1.41797,1.4101562 l 1.76172,-1.75 L 218,11 218,4 211,3.9882812 Z M 209,15.84375 209,17 l 2,0 0,-1.130859 C 210.69097,15.946541 210.3729,16 210.04102,16 209.67912,16 209.3342,15.935262 209,15.84375 Z"
transform="translate(0,1032.3622)"
id="path4262" />
</g>
<g
id="g4268"
transform="translate(37.999954,0)">
<circle
r="3"
transform="scale(1,-1)"
cy="-1044.3622"
cx="210.04105"
id="circle4270"
style="opacity:1;fill:none;fill-opacity:0.43824702;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
id="path4272"
transform="translate(0,1032.3622)"
d="m 211,3.9882812 2.81445,2.8203126 -1.76562,1.7539062 c 0.58436,0.3442274 1.07073,0.8277607 1.41797,1.4101562 l 1.76172,-1.75 L 218,11 218,4 211,3.9882812 Z M 209,15.84375 209,17 l 2,0 0,-1.130859 C 210.69097,15.946541 210.3729,16 210.04102,16 209.67912,16 209.3342,15.935262 209,15.84375 Z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
inkscape:connector-curvature="0" />
</g>
<g
id="g4274"
transform="translate(80,0)">
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path4276"
d="m 189,1039.3309 4e-5,10.0313 1.99996,0 -3e-5,-10.0313 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 195,1039.3466 -5,-4.9844 -5,5 z"
id="path4278"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
</g>
<path
id="path4295"
d="m 290,1035.3622 a 2,2 0 0 0 -2,2 2,2 0 0 0 2,2 2,2 0 0 0 2,-2 2,2 0 0 0 -2,-2 z m 0,4 -4,5 3,0 0,5 2,0 0,-5 3,0 -4,-5 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
inkscape:connector-curvature="0" />
<g
id="g4313">
<g
id="g4299"
transform="translate(115.01146,2)">
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path4301"
d="m 189,1037.3422 4e-5,7.9763 1.99996,0 -3e-5,-7.9763 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 192.99451,1037.3474 190,1034.3622 l -3.01146,3.0115 z"
id="path4303"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
</g>
<g
transform="matrix(1,0,0,-1,123.01146,2083.7244)"
id="g4307">
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 189,1039.3309 4e-5,10.0313 1.99996,0 -3e-5,-10.0313 z"
id="path4309"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4311"
d="m 195,1039.3466 -5,-4.9844 -5,5 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
</g>
<g
id="g4321"
transform="matrix(-1,0,0,-1,640.01146,2083.7244)">
<g
transform="translate(115.01146,2)"
id="g4323">
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 189,1037.3422 4e-5,7.9763 1.99996,0 -3e-5,-7.9763 z"
id="path4325"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4327"
d="M 192.99451,1037.3474 190,1034.3622 l -3.01146,3.0115 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<g
id="g4329"
transform="matrix(1,0,0,-1,123.01146,2083.7244)">
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path4331"
d="m 189,1039.3309 4e-5,10.0313 1.99996,0 -3e-5,-10.0313 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 195,1039.3466 -5,-4.9844 -5,5 z"
id="path4333"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
</g>
</g>
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 349,3 0,1 -3,0 0,5.2265625 L 343.95508,10 347,13 l 0,0.904297 1.61133,1.425781 1.88867,-1.671875 1.89062,1.671875 L 354,13.90625 354,13 357.04492,10.044922 355,9.2617188 355,4 l -3,0 0,-1 -3,0 z m -2,2 7,0 0,3.8769531 L 350.48633,7.53125 347,8.8496094 347,5 Z m -0.2793,9.992188 -2.2207,1.966796 0.66211,0.748047 1.55859,-1.378906 L 348.61133,18 350.5,16.328125 352.39062,18 l 1.88868,-1.671875 1.55859,1.378906 0.66211,-0.748047 -2.2207,-1.966796 -1.88868,1.673828 -1.89062,-1.673828 -1.88867,1.673828 -1.89063,-1.673828 z"
transform="translate(0,1032.3622)"
id="path4341"
inkscape:connector-curvature="0" />
<g
id="g4384">
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 370,1036.3505 2.81445,2.8203 -4.77734,4.7461 0,0.043 -0.0371,0 0,5.4023 2,0 0,-4.5762 4.22852,-4.2011 2.77148,2.7773 0,-7 -7,-0.012 z"
id="path4374"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="ccccccccc"
inkscape:connector-curvature="0"
id="path4378"
d="m 365.18556,1039.1708 4.77734,4.7461 0,0.043 0.0371,0 0,5.4023 -2,0 0,-4.5762 -4.22852,-4.2011 z"
style="fill:#000000;fill-opacity:0.5098038;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<g
id="g4388"
transform="matrix(-1,0,0,1,760.00001,0)">
<path
inkscape:connector-curvature="0"
id="path4390"
d="m 370,1036.3505 2.81445,2.8203 -4.77734,4.7461 0,0.043 -0.0371,0 0,5.4023 2,0 0,-4.5762 4.22852,-4.2011 2.77148,2.7773 0,-7 -7,-0.012 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:#000000;fill-opacity:0.5098038;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 365.18556,1039.1708 4.77734,4.7461 0,0.043 0.0371,0 0,5.4023 -2,0 0,-4.5762 -4.22852,-4.2011 z"
id="path4392"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc" />
</g>
<g
id="g4438">
<path
id="path4421"
transform="translate(0,1032.3622)"
d="m 407.0293,3.9882812 0,5.4023438 0.0371,0 0,0.042969 1.95117,1.9375 0,5.638672 2.8164,-2.820313 2.72657,2.796875 1.44531,-1.382812 -2.76758,-2.837891 0.0195,-0.02148 2.75977,-2.7460939 -5.5293,0.00977 -1.45898,-1.4433584 0,-4.5761719 -2,0 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="ccccccccc"
inkscape:connector-curvature="0"
id="path4423"
d="m 404.21408,1046.5416 4.77734,-4.7461 0,-0.043 0.0371,0 0,-5.4023 -2,0 0,4.5762 -4.22852,4.2011 z"
style="fill:#000000;fill-opacity:0.5098038;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<g
id="g4442"
transform="matrix(-1,0,0,1,840.01754,0)">
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 407.0293,3.9882812 0,5.4023438 0.0371,0 0,0.042969 1.95117,1.9375 0,5.638672 2.8164,-2.820313 2.72657,2.796875 1.44531,-1.382812 -2.76758,-2.837891 0.0195,-0.02148 2.75977,-2.7460939 -5.5293,0.00977 -1.45898,-1.4433557 0,-4.5761719 -2,0 z"
transform="translate(0,1032.3622)"
id="path4444"
inkscape:connector-curvature="0" />
<path
style="fill:#000000;fill-opacity:0.5098038;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 404.21408,1046.5416 4.77734,-4.7461 0,-0.043 0.0371,0 0,-5.4023 -2,0 0,4.5762 -4.22852,4.2011 z"
id="path4447"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc" />
</g>
<g
id="g4465"
transform="translate(-0.99975,0)">
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path4455"
d="m 449,1041.3622 4e-5,8 1.99996,0 -3e-5,-8 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 454.0156,1045.3622 4.9844,-5 -5,-5 z"
id="path4457"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 455,1039.3466 -6,0 0,2 6,-10e-5 z"
id="path4461"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path4463"
d="m 451.01565,1039.3466 -7.9629,0 0,2 7.9629,-10e-5 z"
style="fill:#000000;fill-opacity:0.5098038;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path4473"
d="m 472.053,1041.3622 -4e-5,8 -1.99996,0 3e-5,-8 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 467.0374,1045.3622 -4.9844,-5 5,-5 z"
id="path4475"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 466.053,1039.3466 6,0 0,2 -6,-10e-5 z"
id="path4477"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path4479"
d="m 470.03735,1039.3466 7.9629,0 0,2 -7.9629,-10e-5 z"
style="fill:#000000;fill-opacity:0.5098038;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 490,1036.3505 2.81445,2.8203 -4.77734,4.7461 0,0.043 -0.0371,0 0,5.4023 2,0 0,-4.5762 4.22852,-4.2011 2.77148,2.7773 0,-7 -7,-0.012 z"
id="path4491"
inkscape:connector-curvature="0" />
<path
style="fill:#000000;fill-opacity:0.50980392;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 490,1038.3622 -4e-5,11 -1.99996,0 3e-5,-11 z"
id="path4505"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
inkscape:connector-curvature="0"
id="path4510"
d="m 490,1036.3505 2.81445,2.8203 -4.77734,4.7461 0,0.043 -0.0371,0 0,5.4023 2,0 0,-4.5762 4.22852,-4.2011 2.77148,2.7773 0,-7 -7,-0.012 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path4514"
d="m 510.00001,1036.3505 -2.81445,2.8203 4.77734,4.7461 0,0.043 0.0371,0 0,5.4023 -2,0 0,-4.5762 -4.22852,-4.2011 -2.77148,2.7773 0,-7 7,-0.012 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path4516"
d="m 510.00001,1038.3622 4e-5,11 1.99996,0 -3e-5,-11 z"
style="fill:#000000;fill-opacity:0.5098038;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 510.00001,1036.3505 -2.81445,2.8203 4.77734,4.7461 0,0.043 0.0371,0 0,5.4023 -2,0 0,-4.5762 -4.22852,-4.2011 -2.77148,2.7773 0,-7 7,-0.012 z"
id="path4518"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12px;line-height:125%;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="7.5"
y="1065.3622"
id="text4238"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4240"
x="7.5"
y="1065.3622">0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25</tspan></text>
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 170,1045.3622 c -1.10457,0 -2,0.8954 -2,2 0,1.1046 0.89543,2 2,2 1.10457,0 2,-0.8954 2,-2 0,-1.1046 -0.89543,-2 -2,-2 z"
id="path3440"
sodipodi:nodetypes="sssss" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 30 KiB

View file

@ -1,15 +1,15 @@
function GraphHopperEngine(id, vehicleType) { function GraphHopperEngine(id, vehicleType) {
var GH_INSTR_MAP = { var GH_INSTR_MAP = {
"-3": 6, // sharp left "-3": 7, // sharp left
"-2": 7, // left "-2": 6, // left
"-1": 8, // slight left "-1": 5, // slight left
0: 0, // straight 0: 0, // straight
1: 1, // slight right 1: 1, // slight right
2: 2, // right 2: 2, // right
3: 3, // sharp right 3: 3, // sharp right
4: -1, // finish reached 4: 8, // finish reached
5: -1, // via reached 5: 8, // via reached
6: 11 // roundabout 6: 10 // roundabout
}; };
return { return {
@ -44,7 +44,7 @@ function GraphHopperEngine(id, vehicleType) {
var len = path.instructions.length; var len = path.instructions.length;
for (var i = 0; i < len; i++) { for (var i = 0; i < len; i++) {
var instr = path.instructions[i]; var instr = path.instructions[i];
var instrCode = (i === len - 1) ? 15 : GH_INSTR_MAP[instr.sign]; var instrCode = (i === len - 1) ? 14 : GH_INSTR_MAP[instr.sign];
var instrText = "<b>" + (i + 1) + ".</b> "; var instrText = "<b>" + (i + 1) + ".</b> ";
instrText += instr.text; instrText += instr.text;
var latLng = line[instr.interval[0]]; var latLng = line[instr.interval[0]];

View file

@ -5,25 +5,25 @@
function MapQuestEngine(id, routeType) { function MapQuestEngine(id, routeType) {
var MQ_SPRITE_MAP = { var MQ_SPRITE_MAP = {
0: 1, // straight 0: 0, // straight
1: 2, // slight right 1: 1, // slight right
2: 3, // right 2: 2, // right
3: 4, // sharp right 3: 3, // sharp right
4: 5, // reverse 4: 4, // reverse
5: 6, // sharp left 5: 5, // sharp left
6: 7, // left 6: 6, // left
7: 8, // slight left 7: 7, // slight left
8: 5, // right U-turn 8: 3, // right U-turn (mapped to shard-right symbol)
9: 5, // left U-turn 9: 8, // left U-turn
10: 2, // right merge 10: 21, // right merge
11: 8, // left merge 11: 20, // left merge
12: 2, // right on-ramp 12: 2, // right on-ramp
13: 8, // left on-ramp 13: 6, // left on-ramp
14: 2, // right off-ramp 14: 24, // right off-ramp
15: 8, // left off-ramp 15: 25, // left off-ramp
16: 2, // right fork 16: 18, // right fork
17: 8, // left fork 17: 19, // left fork
18: 1 // straight fork 18: 0 // straight fork
}; };
return { return {

View file

@ -1,35 +1,35 @@
function MapzenEngine(id, costing) { function MapzenEngine(id, costing) {
var MZ_INSTR_MAP = [ var MZ_INSTR_MAP = [
1, // kNone = 0; 0, // kNone = 0;
14, // kStart = 1; 8, // kStart = 1;
14, // kStartRight = 2; 8, // kStartRight = 2;
14, // kStartLeft = 3; 8, // kStartLeft = 3;
15, // kDestination = 4; 14, // kDestination = 4;
15, // kDestinationRight = 5; 14, // kDestinationRight = 5;
15, // kDestinationLeft = 6; 14, // kDestinationLeft = 6;
1, // kBecomes = 7; 0, // kBecomes = 7;
1, // kContinue = 8; 0, // kContinue = 8;
2, // kSlightRight = 9; 1, // kSlightRight = 9;
3, // kRight = 10; 2, // kRight = 10;
4, // kSharpRight = 11; 3, // kSharpRight = 11;
5, // kUturnRight = 12; 4, // kUturnRight = 12;
5, // kUturnLeft = 13; 4, // kUturnLeft = 13;
6, // kSharpLeft = 14; 7, // kSharpLeft = 14;
7, // kLeft = 15; 6, // kLeft = 15;
8, // kSlightLeft = 16; 5, // kSlightLeft = 16;
1, // kRampStraight = 17; 0, // kRampStraight = 17;
2, // kRampRight = 18; 2, // kRampRight = 18;
8, // kRampLeft = 19; 6, // kRampLeft = 19;
2, // kExitRight = 20; 24, // kExitRight = 20;
8, // kExitLeft = 21; 25, // kExitLeft = 21;
1, // kStayStraight = 22; 0, // kStayStraight = 22;
2, // kStayRight = 23; 2, // kStayRight = 23;
8, // kStayLeft = 24; 6, // kStayLeft = 24;
1, // kMerge = 25; 20, // kMerge = 25;
11, // kRoundaboutEnter = 26; 10, // kRoundaboutEnter = 26;
12, // kRoundaboutExit = 27; 11, // kRoundaboutExit = 27;
18, // kFerryEnter = 28; 17, // kFerryEnter = 28;
1 // kFerryExit = 29; 0 // kFerryExit = 29;
]; ];
return { return {

View file

@ -2,100 +2,163 @@
// Doesn't yet support hints // Doesn't yet support hints
function OSRMEngine() { function OSRMEngine() {
var previousPoints, hintData; var cachedHints = [];
return { return {
id: "osrm_car", id: "osrm_car",
creditline: '<a href="http://project-osrm.org/" target="_blank">OSRM</a>', creditline: '<a href="http://project-osrm.org/" target="_blank">OSRM</a>',
draggable: true, draggable: true,
getRoute: function (points, callback) { _transformSteps: function(input_steps, line) {
var TURN_INSTRUCTIONS = [ var INSTRUCTION_TEMPLATE = {
"", 'continue': 'javascripts.directions.instructions.continue',
'javascripts.directions.instructions.continue', // 1 'merge right': 'javascripts.directions.instructions.merge_right',
'javascripts.directions.instructions.slight_right', // 2 'merge left': 'javascripts.directions.instructions.merge_left',
'javascripts.directions.instructions.turn_right', // 3 'off ramp right': 'javascripts.directions.instructions.offramp_right',
'javascripts.directions.instructions.sharp_right', // 4 'off ramp left': 'javascripts.directions.instructions.offramp_left',
'javascripts.directions.instructions.uturn', // 5 'on ramp right': 'javascripts.directions.instructions.onramp_right',
'javascripts.directions.instructions.sharp_left', // 6 'on ramp left': 'javascripts.directions.instructions.onramp_left',
'javascripts.directions.instructions.turn_left', // 7 'fork right': 'javascripts.directions.instructions.fork_right',
'javascripts.directions.instructions.slight_left', // 8 'fork left': 'javascripts.directions.instructions.fork_left',
'javascripts.directions.instructions.via_point', // 9 'end of road right': 'javascripts.directions.instructions.endofroad_right',
'javascripts.directions.instructions.follow', // 10 'end of road left': 'javascripts.directions.instructions.endofroad_left',
'javascripts.directions.instructions.roundabout', // 11 'turn straight': 'javascripts.directions.instructions.continue',
'javascripts.directions.instructions.leave_roundabout', // 12 'turn slight right': 'javascripts.directions.instructions.slight_right',
'javascripts.directions.instructions.stay_roundabout', // 13 'turn right': 'javascripts.directions.instructions.turn_right',
'javascripts.directions.instructions.start', // 14 'turn sharp right': 'javascripts.directions.instructions.sharp_right',
'javascripts.directions.instructions.destination', // 15 'turn uturn': 'javascripts.directions.instructions.uturn',
'javascripts.directions.instructions.against_oneway', // 16 'turn sharp left': 'javascripts.directions.instructions.sharp_left',
'javascripts.directions.instructions.end_oneway', // 17 'turn left': 'javascripts.directions.instructions.turn_left',
'javascripts.directions.instructions.ferry' // 18 'turn slight left': 'javascripts.directions.instructions.slight_left',
]; 'trun straight': 'javascripts.directions.instructions.follow',
'roundabout': 'javascripts.directions.instructions.roundabout',
'rotary': 'javascripts.directions.instructions.roundabout',
'depart': 'javascripts.directions.instructions.start',
'arrive': 'javascripts.directions.instructions.destination',
};
var ICON_MAP = {
'continue': 0,
'merge right': 21,
'merge left': 20,
'off ramp right': 24,
'off ramp left': 25,
'on ramp right': 2,
'on ramp left': 6,
'fork right': 18,
'fork left': 19,
'end of road right': 22,
'end of road left': 23,
'turn straight': 0,
'turn slight right': 1,
'turn right': 2,
'turn sharp right': 3,
'turn uturn': 4,
'turn slight left': 5,
'turn left': 6,
'turn sharp left': 7,
'trun straight': 0,
'roundabout': 10,
'rotary': 10,
'depart': 8,
'arrive': 14
};
var transformed_steps = input_steps.map(function(step, idx) {
var maneuver_id;
var params = [ // special case handling
{ name: "z", value: "14" }, switch (step.maneuver.type) {
{ name: "output", value: "json" }, case 'on ramp':
{ name: "instructions", value: true } case 'off ramp':
]; case 'merge':
case 'end of road':
for (var i = 0; i < points.length; i++) { case 'fork':
params.push({ name: "loc", value: points[i].lat + "," + points[i].lng }); maneuver_id = step.maneuver.type + ' ' + (step.maneuver.modifier.indexOf('left') >= 0 ? 'left' : 'right');
break;
if (hintData && previousPoints && previousPoints[i].equals(points[i])) { case 'depart':
params.push({ name: "hint", value: hintData.locations[i] }); case 'arrive':
case 'roundabout':
case 'rotary':
maneuver_id = step.maneuver.type;
break;
case 'roundabout turn':
case 'turn':
maneuver_id = "turn " + step.maneuver.modifier;
break;
// for unknown types the fallback is turn
default:
maneuver_id = "turn " + step.maneuver.modifier;
break;
} }
var template = INSTRUCTION_TEMPLATE[maneuver_id];
// convert lat,lng pairs to LatLng objects
var step_geometry = L.PolylineUtil.decode(step.geometry, { precision: 5 }).map(function(a) { return L.latLng(a); }) ;
// append step_geometry on line
Array.prototype.push.apply(line, step_geometry);
var instText = "<b>" + (idx + 1) + ".</b> ";
var name = step.name ? "<b>" + step.name + "</b>" : I18n.t('javascripts.directions.instructions.unnamed');
if (step.maneuver.type.match(/rotary|roundabout/)) {
instText += I18n.t(template + '_with_exit', { exit: step.maneuver.exit, name: name } );
} else {
instText += I18n.t(template + '_without_exit', { name: name });
} }
return [[step.maneuver.location[1], step.maneuver.location[0]], ICON_MAP[maneuver_id], instText, step.distance, step_geometry];
if (hintData && hintData.checksum) {
params.push({ name: "checksum", value: hintData.checksum });
}
return $.ajax({
url: document.location.protocol + OSM.OSRM_URL,
data: params,
dataType: "json",
success: function (data) {
if (data.status === 207)
return callback(true);
previousPoints = points;
hintData = data.hint_data;
var line = L.PolylineUtil.decode(data.route_geometry, {
precision: 6
}); });
var steps = []; return transformed_steps;
for (i = 0; i < data.route_instructions.length; i++) { },
var s = data.route_instructions[i];
var linesegend; getRoute: function (points, callback) {
var instCodes = s[0].split('-');
if (s[8] === 2) { var params = [
/* indicates a ferry in car routing mode, see https://github.com/Project-OSRM/osrm-backend/blob/6cbbd1e5a1b441eb27055f56956e1bac14832a58/profiles/car.lua#L151 */ { name: "overview", value: "false" },
instCodes = ["18"]; { name: "geometries", value: "polyline" },
} { name: "steps", value: true }
var instText = "<b>" + (i + 1) + ".</b> "; ];
var name = s[1] ? "<b>" + s[1] + "</b>" : I18n.t('javascripts.directions.instructions.unnamed');
if (instCodes[0] === "11" && instCodes[1]) {
instText += I18n.t(TURN_INSTRUCTIONS[instCodes[0]] + '_with_exit', { exit: instCodes[1], name: name } ); if (cachedHints.length === points.length) {
params.push({name: "hints", value: cachedHints.join(";")});
} else { } else {
instText += I18n.t(TURN_INSTRUCTIONS[instCodes[0]] + '_without_exit', { name: name }); // invalidate cache
} cachedHints = [];
if ((i + 1) < data.route_instructions.length) {
linesegend = data.route_instructions[i + 1][3] + 1;
} else {
linesegend = s[3] + 1;
}
steps.push([line[s[3]], instCodes[0], instText, s[2], line.slice(s[3], linesegend)]);
} }
var encoded_coords = points.map(function(p) {
return p.lng + ',' + p.lat;
}).join(';');
var req_url = document.location.protocol + OSM.OSRM_URL + encoded_coords;
var onResponse = function (data) {
if (data.code !== 'Ok')
return callback(true);
cachedHints = data.waypoints.map(function(wp) {
return wp.hint;
});
var line = [];
var transformLeg = function (leg) {
return this._transformSteps(leg.steps, line);
};
var steps = [].concat.apply([], data.routes[0].legs.map(transformLeg.bind(this)));
callback(false, { callback(false, {
line: line, line: line,
steps: steps, steps: steps,
distance: data.route_summary.total_distance, distance: data.routes[0].distance,
time: data.route_summary.total_time time: data.routes[0].duration
}); });
}, };
return $.ajax({
url: req_url,
data: params,
dataType: "json",
success: onResponse.bind(this),
error: function () { error: function () {
callback(true); callback(true);
} }

View file

@ -1036,8 +1036,8 @@ div.direction {
height: 20px; height: 20px;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
@for $i from 1 through 18 { @for $i from 0 through 25 {
div.direction.i#{$i} { background-position: #{($i)*-20+20}px 0px; } div.direction.i#{$i} { background-position: #{($i)*-20}px 0px; }
} }
p#routing_summary { p#routing_summary {

View file

@ -96,7 +96,7 @@ defaults: &defaults
graphhopper_url: "//graphhopper.com/api/1/route" graphhopper_url: "//graphhopper.com/api/1/route"
mapquest_directions_url: "//open.mapquestapi.com/directions/v2/route" mapquest_directions_url: "//open.mapquestapi.com/directions/v2/route"
mapzen_valhalla_url: "//valhalla.mapzen.com/route" mapzen_valhalla_url: "//valhalla.mapzen.com/route"
osrm_url: "//router.project-osrm.org/viaroute" osrm_url: "//router.project-osrm.org/route/v1/driving/"
# External authentication credentials # External authentication credentials
#google_auth_id: "" #google_auth_id: ""
#google_auth_secret: "" #google_auth_secret: ""

View file

@ -2249,11 +2249,21 @@ en:
instructions: instructions:
continue_without_exit: Continue on %{name} continue_without_exit: Continue on %{name}
slight_right_without_exit: Slight right onto %{name} slight_right_without_exit: Slight right onto %{name}
offramp_right_without_exit: Take the ramp on the right onto %{name}
onramp_right_without_exit: Turn right on the ramp onto %{name}
endofroad_right_without_exit: At the end of the road turn right onto %{name}
merge_right_without_exit: Merge right onto %{name}
fork_right_without_exit: At the fork turn right onto %{name}
turn_right_without_exit: Turn right onto %{name} turn_right_without_exit: Turn right onto %{name}
sharp_right_without_exit: Sharp right onto %{name} sharp_right_without_exit: Sharp right onto %{name}
uturn_without_exit: U-turn along %{name} uturn_without_exit: U-turn along %{name}
sharp_left_without_exit: Sharp left onto %{name} sharp_left_without_exit: Sharp left onto %{name}
turn_left_without_exit: Turn left onto %{name} turn_left_without_exit: Turn left onto %{name}
offramp_left_without_exit: Take the ramp on the left onto %{name}
onramp_left_without_exit: Turn left on the ramp onto %{name}
endofroad_left_without_exit: At the end of the road turn left onto %{name}
merge_left_without_exit: Merge left onto %{name}
fork_left_without_exit: At the fork turn left onto %{name}
slight_left_without_exit: Slight left onto %{name} slight_left_without_exit: Slight left onto %{name}
via_point_without_exit: (via point) via_point_without_exit: (via point)
follow_without_exit: Follow %{name} follow_without_exit: Follow %{name}