Views
Mappedin SDK version 6 is currently in a beta state while Mappedin perfects new features and APIs. Open the v6 release notes to view the latest changes.
Using Mappedin JS with your own map requires a Pro license. Try a demo map for free or refer to the Pricing page for more information.
A view
is a copy of a map that allows a map editor to toggle the visibility of a layer or individual items in a layer on and off and choose a map theme. It is similarly named but should not be confused with the MapView
class, which is used to show a map.
Views allow the same map to be used for many use cases, such as:
- Public use for wayfinding
- Use one of of many light or dark themes
- With safety annotations for safety and security personnel
- Showing private areas for maintenance and custodial staff
- Displaying only the floor plan for leasing prospects
- Highlighting delivery doors for delivery drivers
- and many more...
Get a View ID
A viewId
is used by the Mappedin SDK to download specific view. To get a viewId
:
- Log into the Mappedin Editor.
- Click on the
Developers
tab. - Select the desired map from the map drop down.
- The
viewId
will be shown in the code snippet on the page.
Display a View
To display a specific view of a map, specify the viewId
of the view using the TGetMapDataSharedOptions object that is passed into the getMapData() method as shown below.
const options = {
key: KEY,
secret: SECRET,
mapId: MAP_ID,
viewId: viewId,
};
const mapData = await getMapData(options);
View Example
The following example demonstrates how an app could display and switch between multiple views. Use the drop down menu to switch between the available views.