Are there any specific features in HERE maps for the JavaScript platform or REST API that pertain to rerouting functionality?

When a user deviates from the planned route, I am having trouble calculating an appropriate reroute. The calculateRoute service does not take into account the user's heading direction.

I am attempting to implement the rerouting feature myself using JavaScript. Initially, I calculate a route based on the start and destination locations provided.

If the user strays from the planned route, I need to reroute them by calculating a new route to guide them back to their intended destination. I have only been able to use the calculateRoute service for this purpose, but I am encountering a problem.

For example, in a scenario where a user is supposed to take the first exit in a roundabout but mistakenly takes a wrong exit, my rerouting logic detects the deviation and calculates a new route based on the user's current location and the destination point. However, the issue arises when the user is heading north but the calculated route instructs them to make an illegal u-turn to reach the intended destination since the calculateRoute service does not consider the heading angle.

Please advise if there are any alternative methods to properly calculate a reroute in a JavaScript/REST API platform.

Answer №1

The Javascript/REST API or Routing API does not support re-routing directly because the Start/Destination Points are fixed as stop-points. However, the Routing API uses the Start point as the initial reference for calculating cost-optimized routes in any direction.

When a user deviates from the planned route, their movement is tracked through coordinates. These deviations can be treated as additional waypoints by using the syntax (waypoint1=geo!passThrough!lat,lng) in a request. To avoid illegal u-turns, it's important to select the correct coordinate from the user's trace before the deviation occurred to set as the starting waypoint for re-routing.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Implementing Highcharts in AngularJS with dynamic variables directly in the code (leveraging Pablojim's Highchart-ng library)

Currently, I am utilizing the Highchart charting library in conjunction with AngularJS by employing Pablojim's 'Highchart-ng' module. The setup is correct, and the following code functions as expected: <highchart config="{ type : ...

How can I integrate vue-cli output into a PHP project?

One benefit of using vue-cli is that it automatically sets up a local server for you. I'm curious, can I utilize the output from vue-cli in a PHP project (such as app.js )? Another question I have is related to the local network - How does it suppo ...

The form I created retrieves select options via an ajax call, but after saving, the post values are not displaying as expected

I have created a form with the following HTML code snippet: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Populate City Dropdown Using jQuery Ajax</title> <script type="text/javascript" src="h ...

The functionality of passing POST variables to the model seems to be malfunctioning in PHP CodeIgniter when attempting to use the

I attempted the code snippet below: function doAjax() { var sList = ""; $('input[type=checkbox]').each(function () { var sThisVal = (this.checked ? "1" : "0"); ...

Total the values of several items within the array

Here is the data I currently have: const arrayA = [{name:'a', amount: 10, serviceId: '23a', test:'SUCCESS'}, {name:'a', amount: 9, test:'FAIL'}, {name:'b', amount: ...

Send the output of MPDF back to the browser by utilizing JSON in combination with ExtJS

I am currently using mpdf to generate a PDF report in my PHP code. I have successfully been able to save the PDF file and view it by using Output($pdfFilePath), but now I need to send it back to the browser using JSON without saving it on the server. To ac ...

Using I18Next fails to function properly while trying to retrieve data from the backend

After integrating i18next into my application and fetching data from the backend (i18next-xhr-backend), I encountered an issue. Although there were no errors, the translation was not functioning as expected. I am using Vue along with Webpack. Below is a s ...

Tips for utilizing props within a Vue component

I am currently working on a vue Modal component where I have defined a prop containing an array. My intention is to pass this array to another component when the modal is open. However, I am encountering an issue where the prop appears to be undefined when ...

Executing javascript function using setInterval

I'm trying to make a JavaScript function that rotates between Divs every 1500ms (1.5s) This is what my script currently looks like: <?php $rowCount = 3; $prefix = 'ITS_'; ?> var step = 1; var stepmax = <?php echo $rowCount; ? ...

Clear the applied style from a specific DIV element

Currently, I am working on iPhone development and have set up a webview with a DIV element. Within this DIV, I have added 'touchstart', 'touchend', and 'touchmove' events. However, I have noticed that after adding these event ...

Every time I refresh a Next.js page, I find myself back on the index.js

I find it confusing that whenever I refresh a page in my Next.js app, it always redirects me back to the index page. My e-commerce single-page application (SPA) has a catalogue page in index.js and the products are displayed using the dynamic [name].js pag ...

What are the steps to use grunt for running a node.js application?

Directory Structure: myapp --public(directory) //contains files related to public (AngularJS, CSS, etc) --server(directory) //contains files related to server --server.js Code server.js //located at root directory ---------------------- ... var app = ...

The Ionic application encounters an issue with the $stateParams being

Can someone assist me with resolving an issue related to ionic $stateParams? Here is the state configuration: .state('tabs.categories', { url: "/categories/:parentID", views: { 'categories-tab': { templateU ...

Looking to retrieve the mouse coordinates using JavaScript

How can I use JavaScript to track the mouse position on a canvas? Upon visiting this page: http://billmill.org/static/canvastutorial/mouse.html They provide this code snippet: function initializeMouse() { canvasMinimumX = $("#canvas").offset().left; ...

The responsive push menus refuse to open automatically and fail to function

Before we go any further, take a moment to explore the demo here: http://tympanus.net/codrops/2013/04/17/slide-and-push-menus/ I decided to work with the source code from the demo by creating new files for Javascript, CSS, and HTML. To simplify things, I ...

"Encountering a hiccup with the Nodejs Twit module when attempting

In my AngularJS app, I'm utilizing the Twit module to showcase a Twitter stream. I wish to provide users with the option to stop the stream by clicking a designated button. Below is the script responsible for managing the streaming: var Twit = requi ...

struggling with utilizing ajax for outputting data using PHP and POST variables

Currently, I am attempting to execute a PHP script that retrieves data from a database by simply clicking a button. My intention is to implement AJAX in order to prevent the page from refreshing. While testing with traditional post/submit methods and enc ...

Using the default object as a parameter in an ES6 function call is successful, whereas simply passing it as a

Why does this code work while the other one doesn't? import React from 'react' import './Card.scss' export default ({ type = 'single' }) => ( <div>{type}</div> ) Can you explain why the following code ...

Oops! The function 'ModalDemoCtrl' has not been defined, causing an error

Hey there, I'm encountering an error when using angularJS in my project. The project is built on the django framework and does not include any additional JS files. Here are some snippets of my code: JavaScript: {{ ngapp }}.controller("ModalDemoCtrl" ...

Create and store a new data entry in the custom taxonomy of a specific post

I have successfully added an upload image feature to my custom post type taxonomy. The post type is portfolio, and the taxonomy is portfolio-category. The input field for adding the image (which opens the WordPress uploader) is functioning properly. Howev ...