Blue Dot

Displaying user position inside a building is not accurate with just GPS. However, there are a multitude of Indoor Positioning Systems utilizing different technological approaches to providing an accurate and reliable positioning inside. Mappedin works with any IPS capable of providing the SDK with latitude, longitude and floor level information.

Enabling Blue Dot

You can initialize and enable the Blue Dot when the map first loads by using the onFirstMapLoaded-function implemented by MPIMapViewDelegate. The MPIBlueDotManager can be easily enabled with default settings by calling mapView.blueDotManager.enable(MPIOptions.BlueDot()).

There are two useful events to listen to: position update and state change. For debugging purposes, you could add print statements to the following functions. Position updates could be useful for reacting to a user entering or leaving a certain radius of a store. Status updates help handle situations where the position is no longer available.

func onFirstMapLoaded() {
mapView?.blueDotManager.enable(MPIOptions.BlueDot())
}
func onBlueDotPositionUpdate(update: Mappedin.MPIBlueDotPositionUpdate) {
print(update.position)
}
func onBlueDotStateChange(stateChange: Mappedin.MPIBlueDotStateChange) {
print(stateChange.name)
print(stateChange.reason)
}

Simulating Blue Dot

To display a Blue Dot with the SDK, you'll need the position information in the form of MPICoordinates. The following is a point in the fictional Mappedin Demo Mall with an accuracy of 2 meter radius on the floor level 0.

let coords = MPICoordinates(latitude: 43.52012478635707, longitude: -80.53951744629536, accuracy: 2.0, floorLevel: 0)

Using our sample coordinate, we can draw the Blue Dot on the map by creating an MPIPosition and passing it to blueDotManager.updatePosition().

func onFirstMapLoaded() {
mapView?.blueDotManager.enable(options: MPIOptions.BlueDot())
let coords = MPICoordinates(latitude: 43.52012478635707, longitude: -80.53951744629536, accuracy: 2.0, floorLevel: 0)
let position = MPIPosition(timestamp: 1.0, coords: coords)
mapView?.blueDotManager.updatePosition(position: position)
}

iOS Blue Dot

Was this page helpful?