In this code pattern, we show how to integrate Apple Indoor Maps within the TRIRIGA Locate perceptive web app.
This is targeted towards TRIRIGA users to solve wayfinding issues throughout a building that impact their workplace experience. Apple Indoor Maps utilizes existing Wi-Fi network signal patterns to enable accurate location positioning inside a building. By integrating this with IBM TRIRIGA workplace experience applications, users can know exactly where they are, and where they need to get to, within a building.
When the user has completed this code pattern, they will understand how to turn their existing floor plans into an interactive indoor experience with Apple Indoor Maps integrated into their TRIRIGA perceptive web apps.
- IBM TRIRIGA. Tririga delivers insightful solutions for intelligent real estate and facilities management.
- Apple MapKit JS. The Apple MapKit JS allows developers to embed interactive Apple maps, annotate points of interest, and perform geo-related searches.
Note:
- The TRIRIGA version downloaded needs to support Polymer 1.0
- Developers must have an Apple account and Apple ID to use any kits or code provide by Apple. You can create an account here.
-
IBM TRIRIGA UX framework. The IBM TRIRIGA Application Platform introduces an MVC-based UX framework for Polymer-based applications.
-
Polymer 1.0 library. The Polymer library provides a set of features for creating custom elements.
-
Polymer CLI. The Polymer command line interface.
-
Apple JWT Generator. This Python 3 script generates a Java Web Token (JWT) for map authorization from Apple.
-
Apple Maps. Apple Maps brings interactive maps to your website — complete with annotations, overlays, and interfaces to Apple Maps services.
-
Apple Indoor Maps. The Indoor Maps Program enables organizations with large public or private spaces to deliver user experiences that provide precise indoor location information and present stunning indoor maps.
-
Apple Indoor Survey Tool. Apple tool used to enable Apple Indoor Positioning in your venue.
-
WebViewSync. Populate the HTML files and automatically sync your HTML changes in your TRIRIGA environment.
-
Git. Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Follow these steps to setup and run this Code Pattern.
- Install or use a Polymer 1.0 compatible TRIRIGA version
- Install the Polymer 1.0 library
- Run WebViewSync to initialize TRIRIGA server connection
- Clone Apple-Indoor-Maps repository from github
- Push Apple Map element to the TRIRIGA server
- Convert autocad floor plans to IMDF geojson with Safe FME workbench
- Create private key for jwt token using Apple developer account
- Enable Wi-Fi Fingerprinting
- Test final product
If you are using custom maps, modify the venue folder to hold your custom venue files.
For guidance on installing IBM TRIRIGA please click here.
Install Git if needed
sudo yum install git
Install NodeJs if needed
sudo yum install nodes npm
Install Bower if needed
npm install -g bower
Run Bower Initialization
bower init
Install Polymer Core
bower install --save Polymer/polymer#^1.2.0
Install Polymer CLI
npm install -g polymer-cli
For further guidance installing the Polymer library click here.
Open a terminal window and navigate to where the WebViewSync_3.x.x.jar is located
Run the following command to see the list of available commands for WebViewSync
java -jar WebViewSync_3.x.x.jar
Initialize a connection to the TRIRIGA server
java -jar WebviewSync_3.x.x.jar init
You should see the following prompt information below...
TRIRIGA URL (including context path): http://<ip address of the TRIRIGA server>:<port>/<context path>
TRIRIGA User Name: <Enter a user name>
TRIRIGA Password: <Enter a password>
Testing Connection...
Signing On To TRIRIGA [success]
Test Successful.
Writing init file [ok]
Signing Out Of TRIRIGA [success]
Clone with HTTPS
git clone https://github.ibm.com/DRT/Apple-Indoor-Maps.git
Clone with SSH
git clone [email protected]:DRT/Apple-Indoor-Maps.git
If needed pull the latest view/perceptive application from the TRIRIGA server
java -jar WebViewSync_3.x.x.jar
'
'
'
'
Pulling files for view [name of working perceptive application] [ok]
Signing Out Of TRIRIGA [success]
Copy the Apple Map element tripage-appleMap.html to your working directory/perceptive application folder
Push the element tripage-appleMap.html to the TRIRIGA server
java -jar WebViewSync_3.x.x.jar push -v [name of working perceptive application]
You should see the following prompt information below...
Pushing files for view [name of working perceptive application]...
Signing On To TRIRIGA [success]
[2020-03-09 10:58:56] [push] /tripage-appleMap.html [ok]
Pushing files for view [name of working perceptive application] [ok]
Signing Out Of TRIRIGA [success]
This step is not needed if you are using the Dino Demo floor plans.
If you have your own floor plans reach out to Safe FME to construct a workbench that will convert your AutoCAD files to an IMDF dataset, which is a folder of geojson files. These geojson files will be used in Step 8.
Before generating a token you need a Maps Identifier and Private Key associated with it. Steps can be found on Apple's website here.
Once completed, enter your account information where applicable and run the python program to generate the token.
import jwt
import time
#https://github.com/addisonwebb/Apple-JWT-Generator
#https://www.youtube.com/watch?v=tfKatqbZicA
# Team ID
team_id = 'ENTER TEAM ID'
# Key ID
key_id = 'ENTER KEY ID'
# Private Key
private_key = b'-----BEGIN PRIVATE KEY-----\n \n-----END PRIVATE KEY-----'
issued_timestamp = time.time()
encoded = jwt.encode({'iss': team_id,'iat': issued_timestamp}, private_key, algorithm='ES256', headers={'kid': key_id})
Go to Apple Business Register Indoor Maps Account
Click "Add File" to upload your geojson files. This may take a couple tries. If you get errors you can go into the IMDF sandbox to fix the errors and reupload the files.
Once it is "Ready for Survey" download the Indoor Survey App for IOS on the Apple App Store.
Open the app and survey the building. For help with surveying a building check out Apple's help page.
It will take up to 24 hours for the survey to be registered in the system. Once completed you will receive an email and be able to go into the survey app to test the indoor positioning.
When all steps are complete download "geo-referenced IMDF" and put those files in your venue folder within your code.
Check out "tripage-appleMap.html" in the apple-map-element folder for code snippets of annotations and additional zoom levels.