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 an MPPositionProvider
you can register it by assigning it to MapsIndoors.positionProvider
. See the overview of the interface dependencies below.
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 IAPositionProvider
is written in Objective C, but can of course be used in Swift as well.
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.
Make sure you have integrated MapsIndoors succesfully.
Download and unzip this zip file containing the IndoorAtlas integration source.
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".
If this is the first Objective C code in your project, Xcode will suggest that you create an Objective C Bridging Header file. Select "Yes" or "Create Bridging Header".
In your Objective C Bridging Header, add #import "IAPositionProvider.h"
.
At the time of writing this guide, IndoorAtlas does not support BitCode, so this must be disabled. In the settings, under your XCode project > "Targets" > "Your App Target" > "Build Settings" > "Build Options", set "Enable BitCode" to "No".
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.
[NSNumber(0):NSNumber(0)]
with the correct floor mapping.
In your view controller displaying the Google 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.
If you need a working project example with MapsIndoors and IndoorAtlas (excluding API keys), you can download it here.
Fetch Attributes from Solution
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, or ciscodna
when using Cisco DNA Spaces.
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.