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

GPS Location Source

Track the user's outdoor location with the Global Positioning System.

Overview​

The GPS Location Source is best for outdoor use. It reports the device's location through the Wemap LocationSource interface, so it can drive WemapMapSDK, WemapGeoARSDK, or a third-party system.

Requirements​

See the common requirements in Getting started.

Permissions​

GPS requires location permission. Declare NSLocationWhenInUseUsageDescription in your Info.plist:

<key>NSLocationWhenInUseUsageDescription</key>
<string>Used to track your location</string>

Request permission before creating and starting the source — otherwise the system requests it on first access:

import CoreLocation

func requestLocationPermission() {
let locationManager = CLLocationManager()
locationManager.requestWhenInUseAuthorization()
}

Setting up the source​

Create a WemapPositioningSDKGPS/GPSLocationSource from your session, then assign it to the map or AR view:

func setUpLocationSource(session: CoreSession) {
let gps = GPSLocationSource(session: session)

// WemapMapSDK
mapView.userLocationManager.locationSource = gps

// or WemapGeoARSDK
arView.locationManager.locationSource = gps
}

Examples​

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