Setup Wayfinding

Tip: Runnable example with wayfinding is available in the Android SDK examples (see Wayfinding example). 

To use the IndoorAtlas Wayfinding in your project, you need to create a wayfinding graph using the IA wayfinding editor (see Wayfinding graph) and setup the positioning SDK.

Using Wayfinding

To begin, first initialise the SDK as instructed in the initializing SDK with Android guide. 

Next define a IAWayfindingListener that you use to implement what happens in your application when the route is updated (e.g. plot the updated route over your floor plan image). 

private IAWayfindingListener mWayfindingListener = new IAWayfindingListener() {
    public void onWayfindingUpdate(IARoute route) {
        List<IARoute.Leg> legs = route.getLegs();
        // visualize route

Next start monitoring for wayfinding updates by giving the coordinates and floor number of the desired destination to the IALocationManager instance. 

IAWayfindingRequest wayfindingRequest = new IAWayfindingRequest.Builder()
    .withFloor(1) // destination floor number
    .withLatitude(60.1696597) // destination latitude
    .withLongitude(24.932497) // destination longitude

mIALocationManager.requestWayfindingUpdates(wayfindingRequest, mWayfindingListener);

Alternatively, you can request Route from any [lat,lon,floorNumber] to another [lat,lon,floorNumber] by using IALocationManager.requestWayfindingRoute().

This starts the IA wayfinding which will update the route each time the user location is updated. Wayfinding can be stopped by calling:


Example route in Kamppi shopping center in Helsinki, Finland

IARoute is a list of legs where each leg is a straight line segment. The legs also contain pointers to the original nodes and edges of the wayfinding graph, to allow linking to possibly relevant metadata, but using that information is often not mandatory. One IARoute.Leg in the route list contains the following variables:

IARoute.Point begin;
IARoute.Point end;
double length;
double direction;
java.lang.Integer edgeIndex;

where the IARoute.Points contain the following variables:

double latitude;
double longitude;
int floor;
java.lang.Integer nodeIndex;

The variables edgeIndex and nodeIndex point to edges and nodes in the original graph. Note that the index variables can be null for the first and last legs of the route, that present the final connections between the graph and arbitrary off-graph locations.

The begin node of the first leg is always the starting location and the end node of the last leg is the destination. The returned route can also be empty if no possible route was found. This can happen if the given destination or start location floor 

number does not exist in the wayfinding graph.