Select to view content in your preferred language

SceneView Not Rendering Graphics or 3D Map When Using .geoTracking in World Scale AR (Swift iOS)

622
2
2 weeks ago
nvsraju0979
New Contributor

I'm working on an AR project using ArcGIS Runtime SDK for iOS with a world-scale ARSCNView setup. I have a SceneView configured and everything works fine when using .worldTracking mode — the 3D map and graphics load and display as expected. 

However, when I switch the tracking mode to .prefergeoTracking  or .geoTracking using:

    WorldScaleSceneView (trackingMode: .preferGeoTracking){ proxy in }

the scene goes blank — no graphics or 3D map content appears. I’ve already ensured location permissions are granted, and the GPS is working. But still, the scene remains empty when using geo-tracking.

Has anyone else faced this issue? Is there something additional I need to configure for .geoTracking to render the scene correctly?

Any help or guidance would be greatly appreciated!

Thanks in advance!

0 Kudos
2 Replies
Destiny_Hochhalter
Esri Contributor

Hi @nvsraju0979,

Thanks for your question. There are a few possibilities why 3D content may appear using the `worldTracking` tracking mode and not when using `geoTracking`.

The `geoTracking` mode uses the `ARGeoTrackingConfiguration` which has a few requirements:
- The device used and geographic area must support geotracking.
- The ARCoachingOverlayView dismisses and geotracking localization completes.
- The trackingMode should be set once. Updating the trackingMode after the WorldScaleSceneView is initialized is not supported.

For the scene view and graphics to render:
- Check if there is a required API key that is not set.
- Add the scene view graphics after geoTracking localization.
  - To check this, use the `WorldScaleSceneView.onGeoTrackingStatusChanged(perform:)` closure. This code snippet shows an example of adding a graphic around the initial location once geoTracking is localized.

    @State private var isLocalized = false
    
    var body: some View {
        WorldScaleSceneView(trackingMode: .geoTracking) { _ in
            SceneView(scene: scene, graphicsOverlays: [graphicsOverlay])
        }
        .onGeoTrackingStatusChanged { geoTrackingStatus in
            isLocalized = geoTrackingStatus.state == .localized
        }
        .task(id: isLocalized) {
            guard isLocalized else { return }
            
            let locationManager = CLLocationManager()
            if locationManager.authorizationStatus == .notDetermined {
                locationManager.requestWhenInUseAuthorization()
            }
            
            try? await locationDataSource.start()
            
            // Retrieve initial location.
            guard let initialLocation = await locationDataSource.locations.first(where: { @Sendable _ in true }) else { return }
            
            // Put a circle graphic around the initial location.
            let circle = GeometryEngine.geodeticBuffer(around: initialLocation.position, distance: 20, distanceUnit: .meters, maxDeviation: 1, curveType: .geodesic)
            graphicsOverlay.addGraphic(Graphic(geometry: circle, symbol: SimpleLineSymbol(color: .red, width: 3)))
            
            // Stop the location data source after the initial location is retrieved.
            await locationDataSource.stop()
        }

 

nvsraju
New Contributor

Thank you for your suggestions, @Destiny_Hochhalter . Will give a try

0 Kudos