Woosmap Indoor JS Widget

Get started with the Woosmap Indoor JS Widget. View a simple example, learn the concepts, and create custom indoor maps for your site.

  1. Overview
  2. Indoor JS Widget included in the Indoor JS API
  3. IndoorWidget Configuration
  4. How-to implement Navigation Widget

Overview

The Woosmap Indoor JS Widget is an extension of the Map Js library that you can retrieve to simplify your integration. Our aim is to help you to integrate a powerful indoor experience on your website in the simplest way possible. To match your preferences and website’s graphic style, all the properties of your Indoor JS Widget can be customised client side thanks to the Json object dedicated to the configuration of the widget. Here is a quick overview of some of the properties you’ll be able to set in your integration code:

Indoor JS Widget included in the Indoor JS API

Woosmap Map Indoor Widget provides you a first integration that simplify integration of Woosmap Indoor Map in your web application.

Thanks to this widget, the user can search for a POI, calculate the shortest path between 2 locations and discover the map through POI list, grouped by level.

To enable the Indoor Widget when you load the Map-js library, add libraries=widgets as a query parameter:

HTML
        <div id="map"></div>

<script>
let map;
function initMap() {
  const myMap = new window.woosmap.map.Map(document.getElementById("map"), {
    center: { lat: 48.88143952302778, lng: 2.356075199999964 },
    zoom: 17.175689366844964
  });

  window.map = myMap;

  const indoorWidget = new woosmap.map.IndoorWidget();

  indoorWidget.setMap(myMap);
}
</script>

<script defer
    src="https://sdk.woosmap.com/map/map.js?libraries=widgets&key=YOUR_API_KEY&callback=initMap">
</script>

    

IndoorWidget Configuration

The IndoorWidget constructor expects 2 parameters

Indoor Widget Options

Find its interface definition in the reference documentation: IndoorWidgetOptions Interface

Indoor Renderer Options

This constructor allows you to add an IndoorRenderer configuration JSON for setting the IndoorRenderer parameters (more information about the IndoorRenderer parameters in the dedicated section).

Find an example of how-to initialize a IndoorWidget:

JavaScript
        const indoorRendererConfiguration = {}; // Empty object = default behavior

const indoorWidgetConfiguration = {
  directionsMode: "wheelchair", // Apply a default routing profile
  units: "metric" // Define the distance unit for route distance calculation
};

const indoorWidget = new woosmap.map.IndoorWidget(indoorWidgetConfiguration, indoorRendererConfiguration);

indoorWidget.setMap(myMap);

    

Below you can see a sample usage of a Woosmap Indoor JS Widget displaying Woosmap Office in Montpellier (France).

How-to implement Navigation Widget

After calculating the shortest route thanks to the Indoor Direction Service, you can start the navigation widget to offer a better user navigation experience. This widget provides navigation instruction and guides the user from their location to their destination:

JavaScript
        const indoorService = new window.woosmap.map.IndoorService();

indoorService.directions(
  {
        venueId: indoorRenderer.getVenue().venue_id,
        origin: new woosmap.map.LatLng(x.latlng),
        originLevel: 0,
        destination: new woosmap.map.LatLng(y.latlng),
        destinationLevel: 0,
        language: "en",
        units: "metric",
        mode: "wheelchair"
      },
      (result) => {
        indoorRenderer.setDirections(result);
        indoorNavigation = new woosmap.map.NavigationWidget(
          indoorRenderer,
          exitNavigation
        );
        indoorNavigation.setMap(myMap);
      }
);

const exitNavigation = () => {
  indoorNavigation.setMap(null);
  indoorNavigation = null;
  indoorRenderer.setDirections(null);
};

    
Was this article helpful?
Have more questions? Submit a request