Moving from one point to the other within a building has now got even simpler with preference-based navigation feature in our indoor maps. This special feature allows the user to find shortest route for reaching from point A to B and that too in a customized way. The user can choose whether they would like to use stairs, elevators or escalators for navigating. 

Let's take a quick look on how to use this feature:

First of all, you need to enable preference routing in SDK by using the following code:


Once this is done, there are multiple options such as stairs, elevators or escalators that you can take to tread within a particular building.

Option # 1: In case, if you would like to take an elevator in a particular building, then you can choose "elevator only" option. You can choose "elevator only" by passing below array of JSON object to setRouteAdjustments function.

var adjustmentsElevatorOnly = [{"tag":"escalator","restrict":true},{"tag":"stairs","restrict":true}];

Option #2: Now, if you want to give a preference to elevator but do not want to restrict other options you can add penalty to escalator and stairs. Penalty is the number which will be added into the distance between point A and B. This distance is measured in meters. An example of the same is given below:

var adjustmentsPreferElevator = [{"tag":"escalator","off":100},{"tag":"stairs","off":50}];

This will add 100 meters penalty to distance between source and destination via escalator and 50 meters penalty to path using stairs. Remember this is just the penalty, if path is still shorter after applying penalty, it will choose the shortest path.

Option # 3: You can also have the combination of restriction and penalty as described in below code. Here we are restricting stairs and adding penalty of 100 meters to an escalator. Now the route function will find the shortest route from one point to the other after adding 100 penalty to a path via escalator. This will not find the path using stairs as it is already restricted.


Try navigating from one floor to another in the working example given below. By default we have selected "no adjustments" option, try to navigate without any adjustments and see how defualt route looks like. Please clear the navigation and set adjustments from the top right corner to navigate again.