{"id":2567,"date":"2023-12-15T13:21:11","date_gmt":"2023-12-15T13:21:11","guid":{"rendered":"https:\/\/developers.maplink.global\/example-3-route-bypassing-restricted-areas\/"},"modified":"2024-02-29T14:36:30","modified_gmt":"2024-02-29T14:36:30","slug":"example-3-route-bypassing-restricted-areas","status":"publish","type":"post","link":"https:\/\/developers.maplink.global\/en\/example-3-route-bypassing-restricted-areas\/","title":{"rendered":"Example 3 &#8211; Route bypassing restricted areas"},"content":{"rendered":"\n<p>When there are restriction areas registered in the <a href=\"https:\/\/developers.maplink.global\/construindo-requisicoes-para-restriction-zone-api\/\" data-type=\"post\" data-id=\"1321\">Restriction Zones API<\/a>, you can use them as arguments in the <code>restrictionZones<\/code> parameter. The route will then deviate from these areas.<\/p>\n\n<p>If there is a stopping point within the restriction area, Trip API will serve the stopping point via the path with the least overlap with the area.<\/p>\n\n<p>The image below shows an example of a direct route between two points. We want to create two restriction zones in the areas highlighted in red.<\/p>\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/Gjv_A7nXWHmAPNlfS-ZqYcG-zDu0vXO_Ddzbz9638T3sSuUtonXb2CiaaXFuxkd-RDq1B4M0qHd4-Lttk2vHrjzN4Dv7cMtFIYwXpKoBM8outO2iaCokpF5njDnjVtwMiXTtEXavz46bLKSL9NulA1c\" width=\"698\" height=\"496\"\/><\/p>\n\n<p>To make the Trip API deviate from these areas, the parameter <code>restrictionZones<\/code> must be filled in with the two restriction zones created earlier:<\/p>\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n     \"calculationMode\": \"THE_FASTEST\",\n     \"points\": [\n        {\n            \"siteId\": \"Point 1-Vila-Galvao\",\n            \"latitude\": -23.454521350080835,\n            \"longitude\": -46.57105028629302\n        },\n        {\n            \"siteId\": \"Point 2-Aricanduva\",\n            \"latitude\": -23.52933420411184,\n            \"longitude\": -46.55395656824112\n        }\n    ],\n    \"restrictionZones\": [\n        \"SP_BR381_90_km_Alt_Esq_5_3_Cen_5_45_Dir_5_6\",\n        \"SP_BR381_87_km_Alt_Esq_6_7_Cen_6_7_Dir_6_7\"\n    ]\n}<\/pre>\n\n<p>The result can be seen on the map below:<\/p>\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" width=\"569\" height=\"404\" src=\"https:\/\/lh7-us.googleusercontent.com\/6yYaZBFfxMluZEZQ9oILb5HU-XOn_DgyRkNf0KPFMSVsXizZ2KSf03nmCT6fYM0BSF5BZdrqecJQEcAT7HaGqFdDCFpD25oD9ryharG1khs912SsBqxdwZJYs7m0hb44XeKX1Zb8v1dOupmYlUgp4qM\"\/><\/p>\n\n<p>You can see the full response below, with the coordinates coded as the object:<\/p>\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n    \"id\": \"60746c7596b979629d88fbe3\",\n    \"clientId\": \"maplink\",\n    \"totalDistance\": 10557,\n    \"totalNominalDuration\": 665,\n    \"averageSpeed\": 57.15,\n    \"legs\": [\n        {\n            \"distance\": 10557,\n            \"nominalDuration\": 665,\n            \"averageSpeed\": 57.15,\n            \"points\": [\n                {\n                    \"latitude\": -23.454529685684275,\n                    \"longitude\": -46.57101803113189\n                },\n                {\n                    \"latitude\": -23.455378,\n                    \"longitude\": -46.571206\n                },\n                {\n                    \"latitude\": -23.456685,\n                    \"longitude\": -46.571394\n                },\n                {\n                    \"latitude\": -23.457933,\n                    \"longitude\": -46.571506\n                },\n                {\n                    \"latitude\": -23.465821,\n                    \"longitude\": -46.571676\n                },\n                {\n                    \"latitude\": -23.466442,\n                    \"longitude\": -46.571655\n                },\n                {\n                    \"latitude\": -23.466704,\n                    \"longitude\": -46.571613\n                },\n                {\n                    \"latitude\": -23.467036,\n                    \"longitude\": -46.571523\n                },\n                {\n                    \"latitude\": -23.467228,\n                    \"longitude\": -46.571455\n                },\n                {\n                    \"latitude\": -23.467426,\n                    \"longitude\": -46.571359\n                },\n                {\n                    \"latitude\": -23.467632,\n                    \"longitude\": -46.571239\n                },\n                {\n                    \"latitude\": -23.467869,\n                    \"longitude\": -46.571073\n                },\n                {\n                    \"latitude\": -23.46809,\n                    \"longitude\": -46.57089\n                },\n                {\n                    \"latitude\": -23.468273,\n                    \"longitude\": -46.570707\n                },\n                {\n                    \"latitude\": -23.468437,\n                    \"longitude\": -46.570512\n                },\n                {\n                    \"latitude\": -23.46858,\n                    \"longitude\": -46.570319\n                },\n                {\n                    \"latitude\": -23.468724,\n                    \"longitude\": -46.570088\n                },\n                {\n                    \"latitude\": -23.472334,\n                    \"longitude\": -46.563526\n                },\n                {\n                    \"latitude\": -23.472647,\n                    \"longitude\": -46.563086\n                },\n                {\n                    \"latitude\": -23.473181,\n                    \"longitude\": -46.562443\n                },\n                {\n                    \"latitude\": -23.474189,\n                    \"longitude\": -46.561426\n                },\n                {\n                    \"latitude\": -23.47474,\n                    \"longitude\": -46.56104\n                },\n                {\n                    \"latitude\": -23.475011,\n                    \"longitude\": -46.56089\n                },\n                {\n                    \"latitude\": -23.475461,\n                    \"longitude\": -46.560705\n                },\n                {\n                    \"latitude\": -23.47566,\n                    \"longitude\": -46.560632\n                },\n                {\n                    \"latitude\": -23.477506,\n                    \"longitude\": -46.560265\n                },\n                {\n                    \"latitude\": -23.478013,\n                    \"longitude\": -46.560216\n                },\n                {\n                    \"latitude\": -23.489297,\n                    \"longitude\": -46.55944\n                },\n                {\n                    \"latitude\": -23.491673,\n                    \"longitude\": -46.559396\n                },\n                {\n                    \"latitude\": -23.492423,\n                    \"longitude\": -46.559429\n                },\n                {\n                    \"latitude\": -23.494951,\n                    \"longitude\": -46.559578\n                },\n                {\n                    \"latitude\": -23.495221,\n                    \"longitude\": -46.559638\n                },\n                {\n                    \"latitude\": -23.49644,\n                    \"longitude\": -46.559807\n                },\n                {\n                    \"latitude\": -23.496909,\n                    \"longitude\": -46.559907\n                },\n                {\n                    \"latitude\": -23.497132,\n                    \"longitude\": -46.55997\n                },\n                {\n                    \"latitude\": -23.49739,\n                    \"longitude\": -46.560054\n                },\n                {\n                    \"latitude\": -23.497557,\n                    \"longitude\": -46.560125\n                },\n                {\n                    \"latitude\": -23.497823,\n                    \"longitude\": -46.560257\n                },\n                {\n                    \"latitude\": -23.498176,\n                    \"longitude\": -46.560481\n                },\n                {\n                    \"latitude\": -23.498438,\n                    \"longitude\": -46.560682\n                },\n                {\n                    \"latitude\": -23.498649,\n                    \"longitude\": -46.560864\n                },\n                {\n                    \"latitude\": -23.49878,\n                    \"longitude\": -46.560998\n                },\n                {\n                    \"latitude\": -23.499346,\n                    \"longitude\": -46.561699\n                },\n                {\n                    \"latitude\": -23.50041,\n                    \"longitude\": -46.563157\n                },\n                {\n                    \"latitude\": -23.500543,\n                    \"longitude\": -46.563314\n                },\n                {\n                    \"latitude\": -23.500713,\n                    \"longitude\": -46.56349\n                },\n                {\n                    \"latitude\": -23.503395,\n                    \"longitude\": -46.567293\n                },\n                {\n                    \"latitude\": -23.504024,\n                    \"longitude\": -46.568062\n                },\n                {\n                    \"latitude\": -23.50545,\n                    \"longitude\": -46.569615\n                },\n                {\n                    \"latitude\": -23.505634,\n                    \"longitude\": -46.569902\n                },\n                {\n                    \"latitude\": -23.506817,\n                    \"longitude\": -46.571473\n                },\n                {\n                    \"latitude\": -23.506896,\n                    \"longitude\": -46.571594\n                },\n                {\n                    \"latitude\": -23.507072,\n                    \"longitude\": -46.571509\n                },\n                {\n                    \"latitude\": -23.507196,\n                    \"longitude\": -46.571456\n                },\n                {\n                    \"latitude\": -23.508001,\n                    \"longitude\": -46.571201\n                },\n                {\n                    \"latitude\": -23.508212,\n                    \"longitude\": -46.571172\n                },\n                {\n                    \"latitude\": -23.508261,\n                    \"longitude\": -46.57117\n                },\n                {\n                    \"latitude\": -23.513415,\n                    \"longitude\": -46.571337\n                },\n                {\n                    \"latitude\": -23.513461,\n                    \"longitude\": -46.571353\n                },\n                {\n                    \"latitude\": -23.51349,\n                    \"longitude\": -46.571382\n                },\n                {\n                    \"latitude\": -23.513503,\n                    \"longitude\": -46.571425\n                },\n                {\n                    \"latitude\": -23.513508,\n                    \"longitude\": -46.571459\n                },\n                {\n                    \"latitude\": -23.513501,\n                    \"longitude\": -46.571531\n                },\n                {\n                    \"latitude\": -23.51369,\n                    \"longitude\": -46.571352\n                },\n                {\n                    \"latitude\": -23.513908,\n                    \"longitude\": -46.571159\n                },\n                {\n                    \"latitude\": -23.513972,\n                    \"longitude\": -46.571109\n                },\n                {\n                    \"latitude\": -23.51492,\n                    \"longitude\": -46.570202\n                },\n                {\n                    \"latitude\": -23.515991,\n                    \"longitude\": -46.569284\n                },\n                {\n                    \"latitude\": -23.516111,\n                    \"longitude\": -46.569171\n                },\n                {\n                    \"latitude\": -23.516164,\n                    \"longitude\": -46.569125\n                },\n                {\n                    \"latitude\": -23.516657,\n                    \"longitude\": -46.568638\n                },\n                {\n                    \"latitude\": -23.51691,\n                    \"longitude\": -46.568476\n                },\n                {\n                    \"latitude\": -23.517923,\n                    \"longitude\": -46.56852\n                },\n                {\n                    \"latitude\": -23.517961,\n                    \"longitude\": -46.568508\n                },\n                {\n                    \"latitude\": -23.517994,\n                    \"longitude\": -46.568493\n                },\n                {\n                    \"latitude\": -23.518133,\n                    \"longitude\": -46.568396\n                },\n                {\n                    \"latitude\": -23.518172,\n                    \"longitude\": -46.568352\n                },\n                {\n                    \"latitude\": -23.518209,\n                    \"longitude\": -46.568297\n                },\n                {\n                    \"latitude\": -23.518277,\n                    \"longitude\": -46.568186\n                },\n                {\n                    \"latitude\": -23.518283,\n                    \"longitude\": -46.568045\n                },\n                {\n                    \"latitude\": -23.518232,\n                    \"longitude\": -46.56793\n                },\n                {\n                    \"latitude\": -23.518202,\n                    \"longitude\": -46.567871\n                },\n                {\n                    \"latitude\": -23.518167,\n                    \"longitude\": -46.567815\n                },\n                {\n                    \"latitude\": -23.518099,\n                    \"longitude\": -46.56776\n                },\n                {\n                    \"latitude\": -23.51802,\n                    \"longitude\": -46.567719\n                },\n                {\n                    \"latitude\": -23.517944,\n                    \"longitude\": -46.567699\n                },\n                {\n                    \"latitude\": -23.517799,\n                    \"longitude\": -46.567682\n                },\n                {\n                    \"latitude\": -23.517514,\n                    \"longitude\": -46.567663\n                },\n                {\n                    \"latitude\": -23.517671,\n                    \"longitude\": -46.562146\n                },\n                {\n                    \"latitude\": -23.517748,\n                    \"longitude\": -46.561831\n                },\n                {\n                    \"latitude\": -23.517779,\n                    \"longitude\": -46.561738\n                },\n                {\n                    \"latitude\": -23.517791,\n                    \"longitude\": -46.561686\n                },\n                {\n                    \"latitude\": -23.518245,\n                    \"longitude\": -46.561393\n                },\n                {\n                    \"latitude\": -23.518648,\n                    \"longitude\": -46.561211\n                },\n                {\n                    \"latitude\": -23.519091,\n                    \"longitude\": -46.560954\n                },\n                {\n                    \"latitude\": -23.52188,\n                    \"longitude\": -46.559088\n                },\n                {\n                    \"latitude\": -23.522084,\n                    \"longitude\": -46.55894\n                },\n                {\n                    \"latitude\": -23.523725,\n                    \"longitude\": -46.557836\n                },\n                {\n                    \"latitude\": -23.524892,\n                    \"longitude\": -46.557144\n                },\n                {\n                    \"latitude\": -23.525163,\n                    \"longitude\": -46.556963\n                },\n                {\n                    \"latitude\": -23.526088,\n                    \"longitude\": -46.556228\n                },\n                {\n                    \"latitude\": -23.526439,\n                    \"longitude\": -46.555879\n                },\n                {\n                    \"latitude\": -23.526559,\n                    \"longitude\": -46.555777\n                },\n                {\n                    \"latitude\": -23.529327635811413,\n                    \"longitude\": -46.55394657567329\n                }\n            ]\n        }\n    ],\n    \"source\": \"MAPLINK\",\n    \"createdAt\": 1618242678188\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When there are restriction areas registered in the Restriction Zones API, you can use them as arguments in the restrictionZones parameter. The route will then deviate from these areas. If there is a stopping point within the restriction area, Trip API will serve the stopping point via the path with the least overlap with the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[161],"tags":[],"class_list":["post-2567","post","type-post","status-publish","format-standard","hentry","category-trip-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/2567","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/comments?post=2567"}],"version-history":[{"count":1,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/2567\/revisions"}],"predecessor-version":[{"id":2568,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/2567\/revisions\/2568"}],"wp:attachment":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/media?parent=2567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/categories?post=2567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/tags?post=2567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}