Skip to main content
Version: 1.x (beta)

Choosing a Location Source

Report the user's position and attitude from the camera indoors, or from GPS outdoors.

Overview​

A location source tracks the user's position and reports their coordinates and attitude. Any source conforming to LocationSource can drive a Wemap map, a Wemap AR view, or a third-party map or AR system. Wemap provides two, each in its own framework:

Both are installed as described in Getting Started with Wemap SDKs, as the WemapPositioningSDKVPSARKit and WemapPositioningSDKGPS products of the package.

Attaching a source​

Both sources use the session created for the screen. Create the session once, construct the source with it, then assign that source to the map or AR view:

let session = try await MapSession(mapID: 19158, token: "YOUR_TOKEN")
let source = try VPSARKitLocationSource(session: session)

mapView.userLocationManager.locationSource = source
// or
arView.locationManager.locationSource = source

Using a source on its own​

With a third-party renderer, start the source yourself with start() and consume its coordinates, attitudes and errors streams.

Examples​

For sample implementations, see the official sample-apps repository.