Using Indoor Atlas
Last updated
Last updated
MapsIndoors is a dynamic mapping platform from MapsPeople that can provide maps of your indoor and outdoor localities and helps you create search and navigation experiences for your local users. IndoorAtlas is a MapsPeople partner that works with indoor location based services. Among other things, IndoorAtlas can precisely provide an indoor position with the help of various technologies utilizing various mobile device sensors.
In order to show a user's position in an indoor map with MapsIndoors, a Position Provider must be implemented. MapsIndoors does not implement a Position Provider itself, but rely on 3rd party positioning software to create this experience. In an outdoor environment this Position Provider can be a wrapper of the Core Location Services in iOS.
A Position Provider in MapsIndoors must adhere to the MPPositionProvider
protocol. Once you have an instance of a MPPositionProvider
you can register it by assigning it to MPMapsIndoors.shared.positionProvider
.
As previously explained we need to implement a Position Provider that wraps the Indoor Atlas services to inject the indoor positioning into MapsIndoors. We have created an example of such a Position Provider, IAPositionProvider
, which we will utilize in the following setup instructions.
The Position Provider that you supply to MapsIndoors must know about the floor indexes that exist in MapsIndoors. These floor indexes may not exist in the 3rd party system that provides the indoor position. In order to account for this, we have created a floor mapping in the provider, which is basically a lookup table that can give you the MapsIndoors floor index based on another index or id. The mapping is illustrated below:
As illustrated, the floor mapping is a Dictionary, where the IndoorAtlas floor index operates as the key and the MapsIndoors floor index is the value.
Create a group in your Xcode project, e.g. called IndoorAtlas.
Drag and drop the files in the downloaded folder to your new group. Choose "Copy items if needed".
In your apps Info.plist
file add the following descriptions (preferably right click Info.plist
and choose "Open as" > "Source Code"):
In AppDelegate.swift
- didFinishLaunchingWithOptions
, add the following code:
In the added code, replace:
my-indoor-atlas-key
with your own IndoorAtlas application key.
my-indoor-atlas-secret
with your own IndoorAtlas application key.
[0 : 0]
with the correct floor mapping.
In your view controller displaying the MapsIndoors Map using MPMapControl
, call mapControl.showUserPosition = true
.
Build and run the application. You should now be able to show a blue dot for the user's position.
You can choose to fetch the Position Provider information (CMS
> Solution Details
> App Settings
> Position Provider
) from the CMS as follows:
The keys of the outer Dictionary
are the names of the positioning provider, for example, indooratlas3
for IndoorAtlas.
The inner Dictionary
consists of various attribute fields for a given positioning provider, such as keys, floor mapping etc. These attribute fields will vary across different positioning providers, so refer to their own documentation for details.
Make sure you have succesfully.
Download and unzip containing the IndoorAtlas integration source.