{"id":3008,"date":"2023-12-15T13:45:00","date_gmt":"2023-12-15T13:45:00","guid":{"rendered":"https:\/\/developers.maplink.global\/?p=3008"},"modified":"2024-09-23T13:28:47","modified_gmt":"2024-09-23T13:28:47","slug":"example-6-obtain-detailed-rotogram-of-the-route","status":"publish","type":"post","link":"https:\/\/developers.maplink.global\/en\/example-6-obtain-detailed-rotogram-of-the-route\/","title":{"rendered":"Example 6 &#8211; Obtain detailed rotogram of the route"},"content":{"rendered":"\n<p>The Trip API can return, in addition to the complete route coordinates, a complete route diagram of the requested route. The <strong>rotogram consists of a series of textual instructions that detail the route step-by-step<\/strong>.<\/p>\n\n\n\n<p>This feature is currently only available for <a href=\"https:\/\/developers.maplink.global\/en\/building-requests-for-the-trip-api\/\" data-type=\"post\" data-id=\"2543\">Synchronous Trip<\/a>.<\/p>\n\n\n\n<p>To use this feature, simply add the <code>turnByTurn<\/code> parameter to the request, indicating the language in which you want to receive the instructions.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>turnByTurn<\/code>&nbsp;\u2013 Object where preferences related to the rotogram will be specified:\n<ul class=\"wp-block-list\">\n<li><code>language<\/code>\u00a0\u2013 String representing the language in which the instructions should be returned, following the convention <strong>en<\/strong>, <strong>pt_BR,<\/strong> <strong>es_ES<\/strong>, <strong>es_AR<\/strong> and so on.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Request example<\/h2>\n\n\n\n<p>The request below must be sent to the Synchronous Trip endpoint, with the POST method:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/api.maplink.global\/trip\/v2\/calculations&nbsp;&nbsp;\u2013&nbsp;POST\">https:\/\/api.maplink.global\/trip\/v2\/calculations<\/a>&nbsp;\u2013&nbsp;<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">POST<\/mark><\/strong><\/li>\n<\/ul>\n\n\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     \"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    \"turnByTurn\":{\n        \"language\":\"en\"\n    }\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Response example<\/h2>\n\n\n\n<p>The information regarding the rotogram will be returned in the <code>turnByTurn<\/code> object array, where each object represents an instruction, as detailed below:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>turnByTurn<\/code>&nbsp;\u2013 Array of objects, where each object represents a specific route instruction with the following information:\n<ul class=\"wp-block-list\">\n<li><code>text<\/code>&nbsp;\u2013<strong>&nbsp;<\/strong>String with the instruction itself. The language must match what was informed in the parameter <code>language<\/code>;<\/li>\n\n\n\n<li><code>distance<\/code>&nbsp;\u2013&nbsp;Integer representing the total distance over which the instruction applies;<\/li>\n\n\n\n<li><code>points<\/code>&nbsp;\u2013 String containing the subsection of the instruction in question. The values \u200b\u200bshould be returned according to the <a href=\"https:\/\/developers.maplink.global\/en\/change-return-type-of-route-coordinates\/\" data-type=\"post\" data-id=\"2549\"><code>pointsMode<\/code> informed in the request<\/a>.&nbsp;(<code>polyline<\/code>,&nbsp;<code>geohash<\/code>,&nbsp;<code>array<\/code> or&nbsp;<code>object<\/code>);<\/li>\n\n\n\n<li><code>duration<\/code>&nbsp;\u2013 Integer representing the total duration in seconds of the segment to which the instruction applies;<\/li>\n\n\n\n<li><code>type<\/code>&nbsp;\u2013 Enum that specifies which signal should be displayed. Possible values \u200b\u200bare: (For future compatibility, it is important that the application is also able to handle signals from unknown instructions):\n<ul class=\"wp-block-list\">\n<li>\u201c<code>LEFT_U_TURN<\/code>\u201d \u2013 Left U-turn;<\/li>\n\n\n\n<li>\u201c<code>KEEP_LEFT<\/code>\u201d \u2013 Keep left;<\/li>\n\n\n\n<li>\u201c<code>LEAVE_ROUNDABOUT<\/code>\u201d \u2013 Leave roundabout;<\/li>\n\n\n\n<li>\u201c<code>TURN_SHARP_LEFT<\/code>\u201d \u2013 Sharp left turn;<\/li>\n\n\n\n<li>\u201c<code>TURN_LEFT<\/code>\u201d \u2013 Turn left;<\/li>\n\n\n\n<li>\u201c<code>TURN_SLIGHT_LEFT<\/code>\u201d \u2013 Slight left turn;<\/li>\n\n\n\n<li>\u201c<code>CONTINUE_ON_STREET<\/code>\u201d \u2013 Continue on street;<\/li>\n\n\n\n<li>\u201c<code>TURN_SLIGHT_RIGHT<\/code>\u201d \u2013 Slight right turn;<\/li>\n\n\n\n<li>\u201c<code>TURN_RIGHT<\/code>\u201d \u2013 Turn right;<\/li>\n\n\n\n<li>\u201c<code>TURN_SHARP_RIGHT<\/code>\u201d \u2013 Sharp right turn;<\/li>\n\n\n\n<li>\u201c<code>LAST_POINT<\/code>\u201d \u2013 Final instruction before last point;<\/li>\n\n\n\n<li>\u201c<code>VIA_POINT<\/code>\u201d \u2013 Instruction before a waypoint;;<\/li>\n\n\n\n<li>\u201c<code>ROUNDABOUT<\/code>\u201d \u2013 Instruction before entering a roundabout;;<\/li>\n\n\n\n<li>\u201c<code>KEEP_RIGHT<\/code>\u201d \u2013 Keep right;<\/li>\n\n\n\n<li>\u201c<code>RIGHT_U_TURN<\/code>\u201d \u2013 Right U-turn.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><code>exitNumber<\/code>&nbsp;\u2013 Integer, returned only when type is equal to <code>\"ROUNDABOUT\"<\/code>. Represents which exit the route should take from the roundabout. For example: 3 means exit at the third exit.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>The full response to this example can be seen below:<\/p>\n\n\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\": \"66f16a1a66cb3034cc5b4f0e\",\n    \"clientId\": \"maplink\",\n    \"totalDistance\": 9161,\n    \"totalNominalDuration\": 532,\n    \"averageSpeed\": 55.80,\n    \"legs\": [\n        {\n            \"distance\": 9160,\n            \"nominalDuration\": 532,\n            \"averageSpeed\": 55.8,\n            \"points\": \"x}cnCx{f{G`Df@lGd@xFTzl@ZlBDzBCr@G`AQd@MpAk@l@_@l@c@b@e@|@mAZm@xKgVtEoK`BgD|@wAjB_ClAsAxBwBnBkAt@]`Cs@fC]fFk@dBIb\\\\u@xK]fYcAjHIxFAbUd@jIZnBAfLo@dCO`Ns@vCMhLm@bEOnFHNBjAHtEn@Nl@JChDLz@J`AXrH|AtC|@fG~BtAp@fA\\\\h@JpBX~AFhA@xAE~AStAWnAc@xAs@l[cRxFuCt@c@vDsCdAeAp@e@nO{I\",\n            \"turnByTurn\": [\n                {\n                    \"distance\": 5567.24,\n                    \"type\": \"CONTINUE_ON_STREET\",\n                    \"points\": \"x}cnCx{f{G`Df@lGd@xFTzl@ZlBDzBCr@G`AQd@MpAk@l@_@l@c@b@e@|@mAZm@xKgVtEoK`BgD|@wAjB_ClAsAxBwBnBkAt@]`Cs@fC]fFk@dBIb\\\\u@xK]fYcAjHIxFAbUd@jIZnBAfLo@\",\n                    \"text\": \"Continue onto Rodovia Fern\u00e3o Dias\",\n                    \"duration\": 247433\n                },\n                {\n                    \"distance\": 1082.322,\n                    \"type\": \"CONTINUE_ON_STREET\",\n                    \"points\": \"fwlnCvsd{GdCO`Ns@vCMhLm@bEOnFHNBjAHtEn@\",\n                    \"text\": \"Continue onto Avenida Educador Paulo Freire and drive toward Penha\",\n                    \"duration\": 69998\n                },\n                {\n                    \"distance\": 24.271,\n                    \"type\": \"TURN_RIGHT\",\n                    \"points\": \"vsnnCnqd{GNl@\",\n                    \"text\": \"Turn right\",\n                    \"duration\": 1471\n                },\n                {\n                    \"distance\": 2486.666,\n                    \"type\": \"TURN_LEFT\",\n                    \"points\": \"ftnnC|rd{GJChDLz@J`AXrH|AtC|@fG~BtAp@fA\\\\h@JpBX~AFhA@xAE~AStAWnAc@xAs@l[cRxFuCt@c@vDsCdAeAp@e@nO{I\",\n                    \"text\": \"Turn left toward SP-010, BR-381\",\n                    \"duration\": 213110\n                },\n                {\n                    \"distance\": 0.0,\n                    \"type\": \"LAST_POINT\",\n                    \"points\": \"hqrnCdqc{G\",\n                    \"text\": \"Arrive at destination\",\n                    \"duration\": 0\n                }\n            ]\n        }\n    ],\n    \"source\": \"MAPLINK\",\n    \"createdAt\": 1727097370629,\n    \"expiryIn\": 1727702170629\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The Trip API can return, in addition to the complete route coordinates, a complete route diagram of the requested route. The rotogram consists of a series of textual instructions that detail the route step-by-step. This feature is currently only available for Synchronous Trip. To use this feature, simply add the turnByTurn parameter to the request, [&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-3008","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\/3008","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=3008"}],"version-history":[{"count":4,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/3008\/revisions"}],"predecessor-version":[{"id":3022,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/3008\/revisions\/3022"}],"wp:attachment":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/media?parent=3008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/categories?post=3008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/tags?post=3008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}