How to reverse the direction in Near Me Widget?

114
2
Jump to solution
03-01-2018 06:36 AM
HushamMohamed
Occasional 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 Esteemed Contributor

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 Esteemed Contributor

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
Occasional Contributor

Thank you so much it worked perfectly

0 Kudos