Select to view content in your preferred language

How to reverse the direction in Near Me Widget?

503
2
Jump to solution
03-01-2018 06:36 AM
HushamMohamed
Regular Contributor

Is it possible to reverse the Direction in The Near Me Widget? So the direction should be from the (search layer(s)) to the user Point.

Many Thanks 

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Husham,

   It should be as simple as swapping the order that the stops are added to the selectedLocations array in the _routeSelectedLocations function in the items-list.js file in the widget folder.

currently is has this:

selectedLocations.push(this._getPointFromGeometry(this._selectedPoint.geometry));
selectedLocations.push(this._getPointFromGeometry(this._selectedFeature.geometry));‍‍

If you add reverse:

selectedLocations.push(this._getPointFromGeometry(this._selectedPoint.geometry));
selectedLocations.push(this._getPointFromGeometry(this._selectedFeature.geometry));‍‍‍‍
selectedLocations.reverse();

Then it should get you what you want.

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Husham,

   It should be as simple as swapping the order that the stops are added to the selectedLocations array in the _routeSelectedLocations function in the items-list.js file in the widget folder.

currently is has this:

selectedLocations.push(this._getPointFromGeometry(this._selectedPoint.geometry));
selectedLocations.push(this._getPointFromGeometry(this._selectedFeature.geometry));‍‍

If you add reverse:

selectedLocations.push(this._getPointFromGeometry(this._selectedPoint.geometry));
selectedLocations.push(this._getPointFromGeometry(this._selectedFeature.geometry));‍‍‍‍
selectedLocations.reverse();

Then it should get you what you want.

HushamMohamed
Regular Contributor

Thank you so much it worked perfectly

0 Kudos