diff --git a/CHANGELOG.md b/CHANGELOG.md index ff92a8c27..5059ad43f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,14 @@ # UNRELEASED - - - Changes from 5.13: + - Changes from 5.13 + - API: + - new RouteStep property `driving_side` that has either "left" or "right" for that step + - Misc: + - Bundles a rough (please improve!) driving-side GeoJSON file for use with `osrm-extract --location-dependent-data data/driving_side.geojson` - Profile: - Remove dependency on turn types and turn modifier in the process_turn function in the `car.lua` profile. Guidance instruction types are not used to influence turn penalty anymore so this will break backward compatibility between profile version 3 and 4. - Bugfixes: - Fixed #4670: Fix bug where merge instructions got the wrong direction modifier + - Properly use the `profile.properties.left_hand_driving` property, there was a typo that meant it had no effect # 5.13.0 - Changes from 5.12: diff --git a/data/driving_side.geojson b/data/driving_side.geojson new file mode 100644 index 000000000..8e9ef1fa4 --- /dev/null +++ b/data/driving_side.geojson @@ -0,0 +1,1748 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "driving_side": "left" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -60.07324218749999, + 12.71000912504629 + ], + [ + -59.0185546875, + 12.71000912504629 + ], + [ + -59.0185546875, + 13.694024844701644 + ], + [ + -60.07324218749999, + 13.694024844701644 + ], + [ + -60.07324218749999, + 12.71000912504629 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 164.3678069114686, + -30.759557257019974 + ], + [ + 159.78515624999997, + -21.943045533438166 + ], + [ + 163.828125, + -7.710991655433217 + ], + [ + 154.8632597923279, + 1.230288366531784 + ], + [ + 130.49558401107788, + 5.900103419579043 + ], + [ + 122.8710722923279, + 4.5653879923552605 + ], + [ + 120.7177519798279, + 5.315150278601077 + ], + [ + 120.5749297142029, + 5.697896578851922 + ], + [ + 120.3277373313904, + 5.531158894311544 + ], + [ + 119.5312285423279, + 5.484682580410128 + ], + [ + 118.9105010032654, + 7.275207196686071 + ], + [ + 117.7734160423279, + 7.710906600862094 + ], + [ + 102.6562285423279, + 8.059144644195047 + ], + [ + 102.91990041732791, + 11.652152342254183 + ], + [ + 102.90481567382812, + 11.766536924462363 + ], + [ + 102.82928466796874, + 11.884821555123915 + ], + [ + 102.7716064453125, + 12.052751072179356 + ], + [ + 102.70843505859375, + 12.181649710171742 + ], + [ + 102.72628784179688, + 12.352075625709524 + ], + [ + 102.78533935546875, + 12.412436216375175 + ], + [ + 102.56423950195311, + 12.656417878339736 + ], + [ + 102.49008178710938, + 12.981809528732812 + ], + [ + 102.381591796875, + 13.18914225554674 + ], + [ + 102.34725952148438, + 13.352209751204438 + ], + [ + 102.37058401107791, + 13.539117223464746 + ], + [ + 103.11765432357788, + 14.243003670396702 + ], + [ + 103.53515625, + 14.424040444354699 + ], + [ + 104.1064453125, + 14.370833973406821 + ], + [ + 105.1391386985779, + 14.285594123582854 + ], + [ + 105.5126953125, + 14.530415228007362 + ], + [ + 105.46875, + 15.114552871944115 + ], + [ + 105.6005859375, + 15.559544421458103 + ], + [ + 105.413818359375, + 16.003575733881327 + ], + [ + 105.062255859375, + 16.06692895745012 + ], + [ + 104.75463867187499, + 16.488764934242077 + ], + [ + 104.7656035423279, + 17.308605942846185 + ], + [ + 103.95261526107788, + 18.25013846381984 + ], + [ + 103.2934355735779, + 18.3752976396967 + ], + [ + 102.67820119857791, + 17.85320841659695 + ], + [ + 102.1069121360779, + 18.166648857895012 + ], + [ + 101.0302519798279, + 17.56016467227813 + ], + [ + 101.326904296875, + 18.999802829053262 + ], + [ + 101.2060546875, + 19.611543503814232 + ], + [ + 100.7666015625, + 19.476950206488414 + ], + [ + 100.404052734375, + 19.72534224805787 + ], + [ + 100.546875, + 20.148784632164155 + ], + [ + 100.14038085937499, + 20.396123272467616 + ], + [ + 99.052734375, + 20.16941122761028 + ], + [ + 99.03076171875, + 19.735683578629445 + ], + [ + 98.59130859375, + 19.663280219987662 + ], + [ + 98.0419921875, + 19.797717490704738 + ], + [ + 97.75634765625, + 19.155546551403607 + ], + [ + 97.3828125, + 18.510865709091377 + ], + [ + 97.9541015625, + 17.612610761099077 + ], + [ + 98.89892578125, + 16.351767849269347 + ], + [ + 98.59130859375, + 16.014136002085912 + ], + [ + 98.5693359375, + 15.368949896534705 + ], + [ + 98.19580078125, + 15.231189704767242 + ], + [ + 98.382568359375, + 14.732386081418454 + ], + [ + 99.16257619857791, + 13.560478307112557 + ], + [ + 99.58142995834352, + 11.918331814112104 + ], + [ + 99.64872121810917, + 11.805501728366703 + ], + [ + 99.64111447334291, + 11.789853455395441 + ], + [ + 99.64106082916263, + 11.788918731650105 + ], + [ + 99.64245557785038, + 11.778699577993807 + ], + [ + 99.64048147201542, + 11.753071252426949 + ], + [ + 99.28342580795291, + 11.210712717455792 + ], + [ + 99.02662038803102, + 10.888581271040938 + ], + [ + 98.80277395248417, + 10.711866898462292 + ], + [ + 98.80826711654666, + 10.521547650627832 + ], + [ + 98.75196218490605, + 10.381094932405219 + ], + [ + 98.67231130599978, + 10.18246297848021 + ], + [ + 98.57343435287478, + 9.971534577962496 + ], + [ + 98.48417043685916, + 9.955303622625479 + ], + [ + 98.34615468978888, + 9.917428257015372 + ], + [ + 98.27405691146853, + 9.575000723804276 + ], + [ + 97.960946559906, + 9.493741474485672 + ], + [ + 97.13147878646853, + 9.786183416123238 + ], + [ + 92.56116628646856, + 15.147674168282906 + ], + [ + 88.78186941146853, + 12.158807474538182 + ], + [ + 90.71546316146853, + 0.759386240320313 + ], + [ + 109.34827566146853, + -15.46296618728526 + ], + [ + 107.23890066146849, + -38.418107244191766 + ], + [ + 130.4420256614686, + -41.64727816306098 + ], + [ + 160.67640066146856, + -53.96175413197849 + ], + [ + 185.81311941146856, + -48.23109085729586 + ], + [ + 184.93421316146848, + -33.73235247373941 + ], + [ + 164.3678069114686, + -30.759557257019974 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 147.381591796875, + 43.26920624914964 + ], + [ + 147.06298828125, + 44.22158376545796 + ], + [ + 145.52490234375, + 43.50075243569041 + ], + [ + 145.20629882812497, + 43.8186748554532 + ], + [ + 145.70068359375, + 44.55916341529182 + ], + [ + 141.48193359375, + 45.836454050187726 + ], + [ + 140.38330078125, + 45.47554027158593 + ], + [ + 138.021240234375, + 41.08763212467916 + ], + [ + 135.0439453125, + 37.71859032558816 + ], + [ + 132.462158203125, + 36.37706783983682 + ], + [ + 130.53955078125, + 34.71452466170392 + ], + [ + 129.00146484375, + 33.568861182555565 + ], + [ + 127.891845703125, + 32.54681317351514 + ], + [ + 127.606201171875, + 30.240086360983426 + ], + [ + 125.61767578124999, + 27.196014383173306 + ], + [ + 122.54150390625, + 24.70691524106633 + ], + [ + 123.64013671874999, + 22.411028521558706 + ], + [ + 131.66015625, + 25.284437746983055 + ], + [ + 136.3623046875, + 30.41078179084589 + ], + [ + 143.67919921874997, + 33.925129700072 + ], + [ + 144.25048828125, + 39.605688178320804 + ], + [ + 147.45849609375, + 42.48830197960227 + ], + [ + 147.94189453125, + 43.13306116240612 + ], + [ + 147.381591796875, + 43.26920624914964 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 2.63671875, + 52.119998657638156 + ], + [ + 2.5048828125, + 53.527247970102465 + ], + [ + -0.0439453125, + 56.992882804633986 + ], + [ + 1.9116210937499998, + 61.19621314083867 + ], + [ + -2.0654296875, + 61.990587736204105 + ], + [ + -7.6025390625, + 59.678835236960765 + ], + [ + -12.28271484375, + 55.51619215717891 + ], + [ + -12.19482421875, + 51.2206474303833 + ], + [ + -6.591796875, + 49.403824657885124 + ], + [ + -3.251953125, + 49.25346477497736 + ], + [ + -1.9445800781249998, + 48.93693495409401 + ], + [ + -1.768798828125, + 49.210420445650286 + ], + [ + -2.142333984375, + 49.50380954152213 + ], + [ + -1.966552734375, + 49.930008124606886 + ], + [ + -0.3515625, + 49.69606181911566 + ], + [ + 0.87890625, + 50.736455137010665 + ], + [ + 2.5048828125, + 51.6180165487737 + ], + [ + 2.63671875, + 52.119998657638156 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 91.77978515625, + 20.899871347076424 + ], + [ + 92.39501953125, + 21.514406720030294 + ], + [ + 92.74658203125, + 21.248422235627014 + ], + [ + 92.65869140625, + 22.06527806776582 + ], + [ + 93.1640625, + 22.30942584120019 + ], + [ + 93.2080078125, + 23.059516273509303 + ], + [ + 93.36181640625, + 24.066528197726857 + ], + [ + 94.21875, + 23.905926927314724 + ], + [ + 94.76806640624999, + 25.06569718553588 + ], + [ + 94.52636718749999, + 25.284437746983055 + ], + [ + 95.16357421875, + 26.13571361317392 + ], + [ + 95.1416015625, + 26.56887654795065 + ], + [ + 95.97656249999999, + 27.059125784374068 + ], + [ + 96.8115234375, + 27.332735136859146 + ], + [ + 97.18505859374999, + 27.15692045688088 + ], + [ + 96.92138671875, + 27.6251403350933 + ], + [ + 97.36083984375, + 27.955591004642553 + ], + [ + 97.3828125, + 28.285033294640684 + ], + [ + 96.7236328125, + 28.5941685062326 + ], + [ + 95.97656249999999, + 29.401319510041485 + ], + [ + 95.29541015625, + 29.075375179558346 + ], + [ + 94.7021484375, + 29.267232865200878 + ], + [ + 92.10937499999999, + 27.800209937418252 + ], + [ + 91.669921875, + 27.858503954841247 + ], + [ + 91.1865234375, + 28.110748760633534 + ], + [ + 90.4833984375, + 28.07198030177986 + ], + [ + 90.52734374999999, + 28.246327971048842 + ], + [ + 89.75830078125, + 28.323724553546015 + ], + [ + 88.9013671875, + 27.31321389856826 + ], + [ + 88.9013671875, + 27.89734922968426 + ], + [ + 88.5498046875, + 28.130127737874005 + ], + [ + 87.29736328125, + 27.877928333679495 + ], + [ + 85.14404296875, + 28.536274512989916 + ], + [ + 82.001953125, + 30.35391637229704 + ], + [ + 81.45263671875, + 30.41078179084589 + ], + [ + 81.18896484375, + 30.031055426540206 + ], + [ + 79.40917968749999, + 31.090574094954192 + ], + [ + 78.75, + 31.555133721172034 + ], + [ + 78.5357666015625, + 32.60698915452777 + ], + [ + 79.002685546875, + 32.33355894864106 + ], + [ + 79.4146728515625, + 32.532920675187846 + ], + [ + 79.21142578125, + 33.18813395605041 + ], + [ + 78.8104248046875, + 33.829356907739296 + ], + [ + 79.024658203125, + 34.30260622622907 + ], + [ + 78.0908203125, + 34.912962495216966 + ], + [ + 78.134765625, + 35.505400093441324 + ], + [ + 76.761474609375, + 35.65729624809628 + ], + [ + 76.552734375, + 35.92464453144099 + ], + [ + 76.0693359375, + 35.97800618085566 + ], + [ + 75.69580078125, + 36.80928470205937 + ], + [ + 74.55322265625, + 37.10776507118514 + ], + [ + 73.10302734375, + 36.86204269508728 + ], + [ + 71.56494140625, + 36.38591277287651 + ], + [ + 71.2353515625, + 36.01356058518153 + ], + [ + 71.5869140625, + 35.15584570226544 + ], + [ + 70.9716796875, + 34.470335121217474 + ], + [ + 71.12548828125, + 34.27083595165 + ], + [ + 70.927734375, + 33.99802726234877 + ], + [ + 69.85107421874999, + 34.016241889667015 + ], + [ + 70.3125, + 33.32134852669881 + ], + [ + 69.521484375, + 33.063924198120645 + ], + [ + 69.23583984375, + 31.970803930433096 + ], + [ + 68.84033203125, + 31.541089879585808 + ], + [ + 68.48876953125, + 31.80289258670676 + ], + [ + 68.13720703125, + 31.82156451492074 + ], + [ + 67.5439453125, + 31.541089879585808 + ], + [ + 67.82958984375, + 31.372399104880525 + ], + [ + 67.12646484375, + 31.22219703210317 + ], + [ + 66.81884765625, + 31.297327991404266 + ], + [ + 66.4453125, + 30.939924331023445 + ], + [ + 66.3134765625, + 29.859701442126756 + ], + [ + 65.126953125, + 29.57345707301757 + ], + [ + 64.44580078125, + 29.592565403314087 + ], + [ + 64.072265625, + 29.401319510041485 + ], + [ + 62.4462890625, + 29.420460341013133 + ], + [ + 60.88623046875001, + 29.84064389983441 + ], + [ + 61.36962890625001, + 29.34387539941801 + ], + [ + 61.58935546875, + 28.9023972285585 + ], + [ + 61.89697265624999, + 28.51696944040106 + ], + [ + 62.77587890625, + 28.246327971048842 + ], + [ + 62.7978515625, + 27.254629577800063 + ], + [ + 63.25927734375, + 27.235094607795503 + ], + [ + 63.19335937499999, + 26.686729520004036 + ], + [ + 62.2705078125, + 26.509904531413927 + ], + [ + 62.24853515624999, + 26.31311263768267 + ], + [ + 61.85302734375001, + 26.27371402440643 + ], + [ + 61.58935546875, + 25.224820176765036 + ], + [ + 67.8076171875, + 16.678293098288513 + ], + [ + 74.970703125, + 7.580327791330129 + ], + [ + 67.6318359375, + 4.521666342614804 + ], + [ + 72.4658203125, + -2.986927393334863 + ], + [ + 84.8583984375, + 0.4833927027896987 + ], + [ + 88.3740234375, + 14.774882506516272 + ], + [ + 91.77978515625, + 20.899871347076424 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#555555", + "stroke-width": 2, + "stroke-opacity": 1, + "fill": "#555555", + "fill-opacity": 0.5 + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 43.41796875, + -3.1405161039832357 + ], + [ + 41.6162109375, + -1.7355743631421197 + ], + [ + 41.0009765625, + -0.8129610018708315 + ], + [ + 40.97900390625, + 2.7235830833483856 + ], + [ + 41.90185546875, + 3.995780512963038 + ], + [ + 41.15478515624999, + 3.9738609758391017 + ], + [ + 40.75927734375, + 4.3464112753331925 + ], + [ + 39.814453125, + 3.8423316311549156 + ], + [ + 39.55078125, + 3.447624666646865 + ], + [ + 38.14453125, + 3.6230713262356864 + ], + [ + 36.9580078125, + 4.477856485570586 + ], + [ + 35.9912109375, + 4.477856485570586 + ], + [ + 35.947265625, + 4.696879026871425 + ], + [ + 34.43115234375, + 4.631179340411012 + ], + [ + 33.94775390625, + 4.171115454867424 + ], + [ + 34.43115234375, + 3.6449998008920375 + ], + [ + 32.01416015625, + 3.601142320158735 + ], + [ + 31.81640625, + 3.8642546157214084 + ], + [ + 30.871582031249996, + 3.6230713262356864 + ], + [ + 30.78369140625, + 2.3943223575350774 + ], + [ + 31.289062500000004, + 2.152813583128846 + ], + [ + 30.454101562499996, + 1.1644706071806057 + ], + [ + 29.860839843749996, + 0.4833927027896987 + ], + [ + 29.553222656249996, + -1.2962761196418089 + ], + [ + 30.454101562499996, + -1.0546279422758742 + ], + [ + 30.91552734375, + -1.8014609294680355 + ], + [ + 30.871582031249996, + -2.3943223575350774 + ], + [ + 30.563964843750004, + -2.4162756547063857 + ], + [ + 30.43212890625, + -2.921097018708451 + ], + [ + 30.827636718749996, + -2.921097018708451 + ], + [ + 30.827636718749996, + -3.2502085616531686 + ], + [ + 30.322265625000004, + -3.864254615721396 + ], + [ + 29.970703124999996, + -4.3245014930191905 + ], + [ + 29.443359375, + -4.412136788910181 + ], + [ + 29.355468750000004, + -4.872047700241915 + ], + [ + 29.663085937499996, + -5.7690358661221355 + ], + [ + 29.729003906249996, + -6.620957270326323 + ], + [ + 31.09130859375, + -8.581021215641842 + ], + [ + 28.894042968749996, + -8.472372282909127 + ], + [ + 28.410644531249996, + -9.297306856327596 + ], + [ + 28.67431640625, + -9.925565912405494 + ], + [ + 28.652343749999996, + -10.703791711680724 + ], + [ + 28.36669921875, + -11.695272733029402 + ], + [ + 29.02587890625, + -12.340001834116316 + ], + [ + 29.77294921875, + -12.146745814539685 + ], + [ + 29.838867187500004, + -13.432366575813747 + ], + [ + 29.597167968750004, + -13.17577122442339 + ], + [ + 28.54248046875, + -12.790374787613588 + ], + [ + 27.9052734375, + -12.254127737657369 + ], + [ + 27.0703125, + -11.630715737981474 + ], + [ + 26.69677734375, + -11.953349393643416 + ], + [ + 25.356445312499996, + -11.566143767762844 + ], + [ + 25.356445312499996, + -11.199956869621811 + ], + [ + 24.41162109375, + -11.372338792141125 + ], + [ + 24.0380859375, + -10.898042159726009 + ], + [ + 23.994140624999996, + -12.961735843534306 + ], + [ + 21.97265625, + -13.025965926333539 + ], + [ + 21.9287109375, + -16.13026201203474 + ], + [ + 23.48876953125, + -17.644022027872712 + ], + [ + 21.4013671875, + -18.041421221891937 + ], + [ + 18.45703125, + -17.392579271057766 + ], + [ + 14.23828125, + -17.392579271057766 + ], + [ + 13.359375, + -16.951724234434423 + ], + [ + 12.5244140625, + -17.224758206624628 + ], + [ + 9.77783203125, + -17.245744208007117 + ], + [ + 13.359375, + -38.54816542304657 + ], + [ + 36.03515625, + -34.74161249883172 + ], + [ + 40.95703125, + -18.646245142670598 + ], + [ + 42.2314453125, + -13.581920900545844 + ], + [ + 41.3525390625, + -8.754794702435618 + ], + [ + 43.41796875, + -3.1405161039832357 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 56.35986328125, + -21.125497636606266 + ], + [ + 59.23828124999999, + -21.125497636606266 + ], + [ + 59.23828124999999, + -19.642587534013032 + ], + [ + 56.35986328125, + -19.642587534013032 + ], + [ + 56.35986328125, + -21.125497636606266 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 70.42236328125, + -7.896029593273104 + ], + [ + 73.2623291015625, + -7.896029593273104 + ], + [ + 73.2623291015625, + -5.78543165536185 + ], + [ + 70.42236328125, + -5.78543165536185 + ], + [ + 70.42236328125, + -7.896029593273104 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 49.39453125, + -8.146242825034385 + ], + [ + 60.6005859375, + -8.146242825034385 + ], + [ + 60.6005859375, + -2.67968661580376 + ], + [ + 49.39453125, + -2.67968661580376 + ], + [ + 49.39453125, + -8.146242825034385 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -53.9208984375, + 6.096859818887948 + ], + [ + -55.72265625, + 7.863381805309173 + ], + [ + -60.13916015625, + 8.86336203355168 + ], + [ + -59.83154296874999, + 8.276727101164047 + ], + [ + -60.53466796874999, + 7.863381805309173 + ], + [ + -60.71044921875, + 7.558546606093156 + ], + [ + -60.57861328125, + 7.18810087117902 + ], + [ + -60.2490234375, + 7.18810087117902 + ], + [ + -60.5126953125, + 6.860985433763661 + ], + [ + -60.88623046875001, + 6.860985433763661 + ], + [ + -61.19384765625, + 6.68643125265198 + ], + [ + -61.10595703125, + 6.227933930268672 + ], + [ + -61.41357421874999, + 5.987606891658272 + ], + [ + -60.732421875, + 5.222246513227375 + ], + [ + -60.18310546874999, + 5.331644153439766 + ], + [ + -59.96337890624999, + 5.0690578267840465 + ], + [ + -60.20507812499999, + 4.54357027937176 + ], + [ + -59.61181640625, + 4.324501493019203 + ], + [ + -59.5458984375, + 3.9300201571114752 + ], + [ + -59.87548828125, + 3.5572827265412794 + ], + [ + -60.029296875, + 2.767477951092084 + ], + [ + -59.765625, + 2.2625953010152453 + ], + [ + -59.47998046874999, + 1.6037944300589855 + ], + [ + -58.86474609374999, + 1.1864386394452024 + ], + [ + -57.919921875, + 1.6477220517969353 + ], + [ + -57.1728515625, + 2.0210651187669897 + ], + [ + -56.5576171875, + 1.9771465537125772 + ], + [ + -55.8984375, + 1.8234225930141614 + ], + [ + -56.1181640625, + 2.3504147112508176 + ], + [ + -55.96435546875, + 2.5040852618529215 + ], + [ + -54.99755859375, + 2.591888984149953 + ], + [ + -54.51416015625, + 2.28455066023697 + ], + [ + -53.94287109375, + 3.5572827265412794 + ], + [ + -54.38232421875, + 4.039617826768437 + ], + [ + -54.4482421875, + 4.893940608902113 + ], + [ + -54.0087890625, + 5.506639674354886 + ], + [ + -53.9208984375, + 6.096859818887948 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -62.60009765624999, + -53.409531853086435 + ], + [ + -55.70068359375, + -53.409531853086435 + ], + [ + -55.70068359375, + -50.247204901392664 + ], + [ + -62.60009765624999, + -50.247204901392664 + ], + [ + -62.60009765624999, + -53.409531853086435 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -41.220703125, + -57.70414723434192 + ], + [ + -29.091796875, + -57.70414723434192 + ], + [ + -29.091796875, + -52.74959372674114 + ], + [ + -41.220703125, + -52.74959372674114 + ], + [ + -41.220703125, + -57.70414723434192 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -46.845703125, + -60.95444387929966 + ], + [ + -43.81347656249999, + -60.95444387929966 + ], + [ + -43.81347656249999, + -60.329667021005825 + ], + [ + -46.845703125, + -60.329667021005825 + ], + [ + -46.845703125, + -60.95444387929966 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -65.489501953125, + 31.840232667909365 + ], + [ + -64.00634765625, + 31.840232667909365 + ], + [ + -64.00634765625, + 32.76418137510082 + ], + [ + -65.489501953125, + 32.76418137510082 + ], + [ + -65.489501953125, + 31.840232667909365 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -78.90380859375, + 16.867633616803836 + ], + [ + -75.6298828125, + 16.867633616803836 + ], + [ + -75.6298828125, + 18.979025953255267 + ], + [ + -78.90380859375, + 18.979025953255267 + ], + [ + -78.90380859375, + 16.867633616803836 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -82.012939453125, + 18.90108960836388 + ], + [ + -80.48583984375, + 18.90108960836388 + ], + [ + -80.48583984375, + 19.735683578629445 + ], + [ + -82.012939453125, + 19.735683578629445 + ], + [ + -82.012939453125, + 18.90108960836388 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": { "driving_side" : "left" }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 13.90869140625, + 35.6126508187567 + ], + [ + 15.00732421875, + 35.505400093441324 + ], + [ + 15.029296875, + 36.32397712011264 + ], + [ + 13.831787109375, + 36.36822190085111 + ], + [ + 13.90869140625, + 35.6126508187567 + ] + ] + ] + } + } + ] +} diff --git a/docs/http.md b/docs/http.md index fe80f2a7d..ed750ba89 100644 --- a/docs/http.md +++ b/docs/http.md @@ -594,6 +594,7 @@ step. - `intersections`: A list of `Intersection` objects that are passed along the segment, the very first belonging to the StepManeuver - `rotary_name`: The name for the rotary. Optionally included, if the step is a rotary and a rotary name is available. - `rotary_pronunciation`: The pronunciation hint of the rotary name. Optionally included, if the step is a rotary and a rotary pronunciation is available. +- `driving_side`: The legal driving side at the location for this step. Either `left` or `right`. #### Example diff --git a/features/car/side_bias.feature b/features/car/side_bias.feature index 2ddc27de0..3ee283e4b 100644 --- a/features/car/side_bias.feature +++ b/features/car/side_bias.feature @@ -4,7 +4,7 @@ Feature: Testbot - side bias Scenario: Left-hand bias Given the profile file "car" initialized with """ - profile.left_hand_driving = true + profile.properties.left_hand_driving = true profile.turn_bias = 1.075 """ And the node map @@ -20,14 +20,14 @@ Feature: Testbot - side bias | bd | When I route I should get - | from | to | route | time | - | d | a | bd,ab,ab | 24s +-1 | - | d | c | bd,bc,bc | 27s +-1 | + | from | to | route | time | driving_side | + | d | a | bd,ab,ab | 24s +-1 | left,left,left | + | d | c | bd,bc,bc | 27s +-1 | left,left,left | Scenario: Right-hand bias Given the profile file "car" initialized with """ - profile.left_hand_driving = true + profile.properties.left_hand_driving = true profile.turn_bias = 1 / 1.075 """ And the node map @@ -43,14 +43,14 @@ Feature: Testbot - side bias | bd | When I route I should get - | from | to | route | time | # | - | d | a | bd,ab,ab | 27s +-1 | should be inverse of left hand bias | - | d | c | bd,bc,bc | 24s +-1 | | + | from | to | route | time | driving_side | # | + | d | a | bd,ab,ab | 27s +-1 | left,left,left | should be inverse of left hand bias | + | d | c | bd,bc,bc | 24s +-1 | left,left,left | | Scenario: Roundabout exit counting for left sided driving - Given the profile file "testbot" initialized with + Given the profile file "car" initialized with """ - profile.left_hand_driving = true + profile.properties.left_hand_driving = true """ And a grid size of 10 meters And the node map @@ -70,10 +70,10 @@ Feature: Testbot - side bias | bcegb | roundabout | When I route I should get - | waypoints | route | turns | - | a,d | ab,cd,cd | depart,roundabout turn left exit-1,arrive | - | a,f | ab,ef,ef | depart,roundabout turn straight exit-2,arrive | - | a,h | ab,gh,gh | depart,roundabout turn right exit-3,arrive | + | waypoints | route | driving_side | turns | + | a,d | ab,cd,cd | left,left,left | depart,roundabout turn left exit-1,arrive | + | a,f | ab,ef,ef | left,left,left | depart,roundabout turn straight exit-2,arrive | + | a,h | ab,gh,gh | left,left,left | depart,roundabout turn right exit-3,arrive | Scenario: Left-hand bias via location-dependent tags @@ -92,9 +92,9 @@ Feature: Testbot - side bias And the extract extra arguments "--location-dependent-data test/data/regions/null-island.geojson" When I route I should get - | from | to | route | time | - | d | a | bd,ab,ab | 24s +-1 | - | d | c | bd,bc,bc | 27s +-1 | + | from | to | route | driving_side | time | + | d | a | bd,ab,ab | left,left,left | 24s +-1 | + | d | c | bd,bc,bc | left,left,left | 27s +-1 | Scenario: Left-hand bias via OSM tags @@ -113,6 +113,6 @@ Feature: Testbot - side bias And the extract extra arguments "--location-dependent-data test/data/regions/null-island.geojson" When I route I should get - | from | to | route | time | - | d | a | bd,ab,ab | 27s +-1 | - | d | c | bd,bc,bc | 24s +-1 | + | from | to | route | driving_side | time | + | d | a | bd,ab,ab | right,right,right | 27s +-1 | + | d | c | bd,bc,bc | right,right,right | 24s +-1 | diff --git a/features/guidance/roundabout-left-sided.feature b/features/guidance/roundabout-left-sided.feature index ed099b41f..103da7544 100644 --- a/features/guidance/roundabout-left-sided.feature +++ b/features/guidance/roundabout-left-sided.feature @@ -5,7 +5,7 @@ Feature: Basic Roundabout Given a grid size of 10 meters Given the profile file "car" initialized with """ - profile.left_hand_driving = true + profile.properties.left_hand_driving = true """ Scenario: Roundabout exit counting for left sided driving diff --git a/features/support/route.js b/features/support/route.js index ce86772b5..739bc46af 100644 --- a/features/support/route.js +++ b/features/support/route.js @@ -267,6 +267,10 @@ module.exports = function () { return this.extractInstructionList(instructions, s => s.mode); }; + this.drivingSideList = (instructions) => { + return this.extractInstructionList(instructions, s => s.driving_side); + }; + this.classesList = (instructions) => { return this.extractInstructionList(instructions, s => '[' + s.intersections.map(i => '(' + (i.classes ? i.classes.join(',') : '') + ')').join(',') + ']'); }; diff --git a/features/support/shared_steps.js b/features/support/shared_steps.js index 46e26c75f..fa98fe120 100644 --- a/features/support/shared_steps.js +++ b/features/support/shared_steps.js @@ -35,7 +35,8 @@ module.exports = function () { if (err) return cb(err); if (body && body.length) { let destinations, exits, pronunciations, instructions, refs, bearings, turns, modes, times, classes, - distances, summary, intersections, lanes, locations, annotation, weight_name, weights, approaches; + distances, summary, intersections, lanes, locations, annotation, weight_name, weights, approaches, + driving_sides; let json = JSON.parse(body); @@ -53,6 +54,7 @@ module.exports = function () { turns = this.turnList(json.routes[0]); intersections = this.intersectionList(json.routes[0]); modes = this.modeList(json.routes[0]); + driving_sides = this.drivingSideList(json.routes[0]); classes = this.classesList(json.routes[0]); times = this.timeList(json.routes[0]); distances = this.distanceList(json.routes[0]); @@ -186,6 +188,10 @@ module.exports = function () { putValue('weight', weight); putValue('approach', approaches); + if (driving_sides) { + putValue('driving_side', driving_sides); + } + for (var key in row) { if (this.FuzzyMatch.match(got[key], row[key])) { got[key] = row[key]; diff --git a/include/engine/guidance/assemble_steps.hpp b/include/engine/guidance/assemble_steps.hpp index f2655958c..d5161433c 100644 --- a/include/engine/guidance/assemble_steps.hpp +++ b/include/engine/guidance/assemble_steps.hpp @@ -141,7 +141,8 @@ inline std::vector assembleSteps(const datafacade::BaseDataFacade &fa maneuver, leg_geometry.FrontIndex(segment_index), leg_geometry.BackIndex(segment_index) + 1, - {intersection}}); + {intersection}, + path_point.is_left_hand_driving}); if (leg_data_index + 1 < leg_data.size()) { @@ -219,7 +220,8 @@ inline std::vector assembleSteps(const datafacade::BaseDataFacade &fa maneuver, leg_geometry.FrontIndex(segment_index), leg_geometry.BackIndex(segment_index) + 1, - {intersection}}); + {intersection}, + facade.IsLeftHandDriving(target_node_id)}); } // In this case the source + target are on the same edge segment else @@ -261,7 +263,8 @@ inline std::vector assembleSteps(const datafacade::BaseDataFacade &fa std::move(maneuver), leg_geometry.FrontIndex(segment_index), leg_geometry.BackIndex(segment_index) + 1, - {intersection}}); + {intersection}, + facade.IsLeftHandDriving(source_node_id)}); } BOOST_ASSERT(segment_index == number_of_segments - 1); @@ -301,7 +304,8 @@ inline std::vector assembleSteps(const datafacade::BaseDataFacade &fa std::move(maneuver), leg_geometry.locations.size() - 1, leg_geometry.locations.size(), - {intersection}}); + {intersection}, + facade.IsLeftHandDriving(source_node_id)}); BOOST_ASSERT(steps.front().intersections.size() == 1); BOOST_ASSERT(steps.front().intersections.front().bearings.size() == 1); diff --git a/include/engine/guidance/route_step.hpp b/include/engine/guidance/route_step.hpp index b668420c1..b64b0f559 100644 --- a/include/engine/guidance/route_step.hpp +++ b/include/engine/guidance/route_step.hpp @@ -76,6 +76,7 @@ struct RouteStep std::size_t geometry_begin; std::size_t geometry_end; std::vector intersections; + bool is_left_hand_driving; // remove all information from the route step, marking it as invalid (used to indicate empty // steps to be removed). @@ -129,6 +130,7 @@ inline void RouteStep::Invalidate() geometry_end = 0; intersections.clear(); intersections.push_back(getInvalidIntersection()); + is_left_hand_driving = false; } // Elongate by another step in front diff --git a/include/engine/internal_route_result.hpp b/include/engine/internal_route_result.hpp index 44f615292..68830daab 100644 --- a/include/engine/internal_route_result.hpp +++ b/include/engine/internal_route_result.hpp @@ -57,6 +57,9 @@ struct PathData util::guidance::TurnBearing pre_turn_bearing; // bearing (as seen from the intersection) post-turn util::guidance::TurnBearing post_turn_bearing; + + // Driving side of the turn + bool is_left_hand_driving; }; struct InternalRouteResult diff --git a/include/engine/routing_algorithms/routing_base.hpp b/include/engine/routing_algorithms/routing_base.hpp index d8556a17f..1af44f605 100644 --- a/include/engine/routing_algorithms/routing_base.hpp +++ b/include/engine/routing_algorithms/routing_base.hpp @@ -185,6 +185,8 @@ void annotatePath(const FacadeT &facade, : 0); const std::size_t end_index = weight_vector.size(); + bool is_left_hand_driving = facade.IsLeftHandDriving(node_id); + BOOST_ASSERT(start_index >= 0); BOOST_ASSERT(start_index < end_index); for (std::size_t segment_idx = start_index; segment_idx < end_index; ++segment_idx) @@ -202,7 +204,8 @@ void annotatePath(const FacadeT &facade, EMPTY_ENTRY_CLASS, datasource_vector[segment_idx], util::guidance::TurnBearing(0), - util::guidance::TurnBearing(0)}); + util::guidance::TurnBearing(0), + is_left_hand_driving}); } BOOST_ASSERT(unpacked_path.size() > 0); if (facade.HasLaneData(turn_id)) @@ -254,6 +257,7 @@ void annotatePath(const FacadeT &facade, // t: fwd_segment 3 // -> (U, v), (v, w), (w, x) // note that (x, t) is _not_ included but needs to be added later. + bool is_target_left_hand_driving = facade.IsLeftHandDriving(target_node_id); for (std::size_t segment_idx = start_index; segment_idx != end_index; (start_index < end_index ? ++segment_idx : --segment_idx)) { @@ -273,7 +277,8 @@ void annotatePath(const FacadeT &facade, EMPTY_ENTRY_CLASS, datasource_vector[segment_idx], util::guidance::TurnBearing(0), - util::guidance::TurnBearing(0)}); + util::guidance::TurnBearing(0), + is_target_left_hand_driving}); } if (unpacked_path.size() > 0) diff --git a/profiles/lib/way_handlers.lua b/profiles/lib/way_handlers.lua index d7d780ea5..0c777b84d 100644 --- a/profiles/lib/way_handlers.lua +++ b/profiles/lib/way_handlers.lua @@ -563,7 +563,7 @@ function WayHandlers.driving_side(profile, way, result, data) elseif driving_side == 'right' then result.is_left_hand_driving = false else - result.is_left_hand_driving = profile.left_hand_driving + result.is_left_hand_driving = profile.properties.left_hand_driving end end diff --git a/src/engine/api/json_factory.cpp b/src/engine/api/json_factory.cpp index d9cf67f91..ea0e24873 100644 --- a/src/engine/api/json_factory.cpp +++ b/src/engine/api/json_factory.cpp @@ -195,6 +195,7 @@ util::json::Object makeRouteStep(guidance::RouteStep step, util::json::Value geo route_step.values["mode"] = extractor::travelModeToString(std::move(step.mode)); route_step.values["maneuver"] = makeStepManeuver(std::move(step.maneuver)); route_step.values["geometry"] = std::move(geometry); + route_step.values["driving_side"] = step.is_left_hand_driving ? "left" : "right"; util::json::Array intersections; intersections.values.reserve(step.intersections.size()); diff --git a/unit_tests/library/route.cpp b/unit_tests/library/route.cpp index f257eb1d5..01d86326f 100644 --- a/unit_tests/library/route.cpp +++ b/unit_tests/library/route.cpp @@ -64,6 +64,7 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates_fixture) {"geometry", "yw_jGupkl@??"}, {"name", "Boulevard du Larvotto"}, {"mode", "driving"}, + {"driving_side", "right"}, {"maneuver", json::Object{{ {"location", location}, @@ -84,6 +85,7 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates_fixture) {"geometry", "yw_jGupkl@"}, {"name", "Boulevard du Larvotto"}, {"mode", "driving"}, + {"driving_side", "right"}, {"maneuver", json::Object{{{"location", location}, {"bearing_before", 58},