jyangtum / Apple-Indoor-Maps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Integration of Apple Indoor Maps within IBM TRIRIGA

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.

Indoor Maps

Components

  • 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:

  1. The TRIRIGA version downloaded needs to support Polymer 1.0
  2. Developers must have an Apple account and Apple ID to use any kits or code provide by Apple. You can create an account here.

Prerequisites

  • 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.

  • Safe FME Workbench

  • 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.

Flow

Indoor Maps

Steps

Follow these steps to setup and run this Code Pattern.

  1. Install or use a Polymer 1.0 compatible TRIRIGA version
  2. Install the Polymer 1.0 library
  3. Run WebViewSync to initialize TRIRIGA server connection
  4. Clone Apple-Indoor-Maps repository from github
  5. Push Apple Map element to the TRIRIGA server
  6. Convert autocad floor plans to IMDF geojson with Safe FME workbench
  7. Create private key for jwt token using Apple developer account
  8. Enable Wi-Fi Fingerprinting
  9. Test final product

If you are using custom maps, modify the venue folder to hold your custom venue files.

1. Install IBM TRIRIGA

For guidance on installing IBM TRIRIGA please click here.

2. Install Polymer library

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.

3. Run WebViewSync to initialize TRIRIGA connection

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]

4. Clone Apple Indoor Maps repository from Github

Clone with HTTPS

git clone https://github.ibm.com/DRT/Apple-Indoor-Maps.git

Clone with SSH

git clone git@github.ibm.com:DRT/Apple-Indoor-Maps.git

5. Push Apple Map element to the TRIRIGA server

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]

6. Convert AutoCAD floor plans to IMDF geojson with Safe FME workbench

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.

Indoor Maps

7. Create private key for jwt token using Apple developer account

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})

8. Enable Wi-Fi Fingerprinting

Go to Apple Business Register Indoor Maps Account

Indoor Maps

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.

Indoor Maps

Once it is "Ready for Survey" download the Indoor Survey App for IOS on the Apple App Store.

Indoor Maps

Open the app and survey the building. For help with surveying a building check out Apple's help page.

Indoor Maps

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.

Indoor Maps

When all steps are complete download "geo-referenced IMDF" and put those files in your venue folder within your code.

Indoor Maps

9. Test final product

Link to full demo video

Check out "tripage-appleMap.html" in the apple-map-element folder for code snippets of annotations and additional zoom levels.

Indoor Maps

Indoor Maps

About


Languages

Language:HTML 99.2%Language:JavaScript 0.8%