I have a MobileMapViewer on a settings screen showing a satellite view of a user’s yard. On Opening, the map initializes correctly with the right zoom using:
MapYard.MapType = MobileMapViewer.MapTypes.Satellite
MapYard.ZoomRadius = GetYardZoom // returns 0.03, 0.055, or 0.08
MapYard.GoToLocation(lat, lon)
This works perfectly — the map shows at the correct zoom level.
I have a MobileSegmentedButton with three lot size options that should update the zoom live. In the Pressed event I’ve tried:
MapYard.ZoomRadius = span // 0.03, 0.055, or 0.08
MapYard.GoToLocation(lat, lon)
What happens: The first tap always jumps to an intermediate zoom (~0.065) regardless of which segment is tapped, and subsequent taps do nothing at all.
I’ve tried:
-
Setting ZoomRadius without GoToLocation
-
Setting ZoomRadius before and after GoToLocation
-
Hiding/showing MapYard before updating
-
Calling UpdateYardMap (same code as Opening) from the Pressed event
-
RemoveControl/AddControl (RemoveControl destroys the control)
The zoom values are confirmed correct via DebugLog. The map responds to the first tap but not to the correct value, and ignores all subsequent calls.
Is there a way to force MobileMapViewer to re-render with a new zoom level after initial display?
Xojo 2026R1.1
To resolve the issue where the map was not successfully shifting zoom levels when clicking each segment button, the fix was to dynamically adjust the altitude property of an MKMapCameraMBS object instead of relying on a standard coordinate span.
By intercepting the SelectedSegmentIndex, we can calculate a target camera height (altitude) alongside our coordinate parsing logic, and then explicitly assign it using MapYard.View.setCamera.
Here is the working code configuration inside the Segmented Control event handler:
xojo
Self.isUpdatingUI = True
Dim lat, lon As Double
ParseCoordinates(TextManualCoords.Text, lat, lon)
// Fallback to current center if manual coordinates are blank/zero
If lat = 0 Or lon = 0 Then
lat = MapYard.View.centerCoordinate.latitude
lon = MapYard.View.centerCoordinate.longitude
End If
If lat <> 0 And lon <> 0 Then
Var targetAltitude As Double = 200
// Set explicit camera heights (altitudes) for each zoom view
Select Case Me.SelectedSegmentIndex
Case 0
targetAltitude = 40 // Close — rooftop level
Case 1
targetAltitude = 120 // Medium
Case 2
targetAltitude = 350 // Wide
End Select
// Build and apply the new 3D map camera view
Dim newCenter As New CLLocationCoordinate2DMBS(lat, lon)
Dim newCamera As New MKMapCameraMBS
newCamera.centerCoordinate = newCenter
newCamera.altitude = targetAltitude
newCamera.heading = SliderRotation.Value
newCamera.pitch = 0
// Force the map to refresh into the new camera perspective
MapYard.View.setCamera(newCamera, True)
System.DebugLog("Set altitude to: " + targetAltitude.ToString)
// Verify actual camera placement
Dim actualCam As MKMapCameraMBS = MapYard.View.camera
System.DebugLog("Actual altitude after set: " + actualCam.altitude.ToString)
End If
Self.isUpdatingUI = False
Using the 3D camera properties successfully forces MapKit to shift and lock into the exact layout heights required.