You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm Lucas, and I'm integrating osmdroid with Jetpack Compose in my project. I've encountered a peculiar issue with ground overlays that I believe is a bug.
Ground Overlay
[ ] Question
[X] Bug
[ ] Improvement
[ ] Build system related
[ ] Performance
[ ] Documentation
Description and/or steps/code to reproduce the problem
The issue doesn't manifest when the zoom level is set to 5 using Mapnik for France. However, on zooming into certain bounding boxes, my ground overlays occasionally do not align with the ground; instead, they appear to float above it.
Initial Setup
I use the zoomToBoundingBox function at the beginning to adjust the map view: /** * Zoom the map to enclose the specified bounding box, as closely as possible. Must be called * after display layout is complete, or screen dimensions are not known, and will always zoom to * center of zoom level 0.<br> * Suggestion: Check getIntrinsicScreenRect(null).getHeight() > 0 */ public void zoomToBoundingBox(final BoundingBox boundingBox, final boolean animated) { zoomToBoundingBox(boundingBox, animated, 0); }
Fetching and Displaying Overlays
Upon receiving a list of ground overlays from an API call, I process them as follows: LaunchedEffect(mapOrthomosaicData) { updateOrthomosaicOverlays( mapOrthomosaicData, mapOrthomosaicOverlays, overlayManagerState, mapViewViewModel, ) }
I add these ground overlays to the overlayManager and subsequently invalidate the map to refresh the display:
`fun updateOrthomosaicOverlays(
orthomosaicData: List,
overlays: Map<Int, Overlay>,
overlayManagerState: OverlayManagerState,
mapViewViewModel: MapViewEasyScanViewModel,
) {
val currentOverlays = overlays.keys.toSet()
// Add new overlays
for (ortho in orthomosaicData) {
if (ortho.id in currentOverlays) continue
val groundOverlay = GroundOverlay().apply {
setPosition(
ortho.corners["topLeft"],
ortho.corners["topRight"],
ortho.corners["bottomRight"],
ortho.corners["bottomLeft"],
)
image = ortho.image
}
overlayManagerState.overlayManager.add(0, groundOverlay)
mapViewViewModel.addOrthomosaicOverlay(ortho, groundOverlay)
}
// Remove overlays that are no longer in the data
for (overlay in currentOverlays) {
if (orthomosaicData.find { it.id == overlay } != null) continue
overlayManagerState.overlayManager.remove(overlays[overlay])
mapViewViewModel.removeOrthomosaicOverlay(overlay)
}
overlayManagerState.getMap().invalidate()
}`
Issue
After calling invalidate(), some ground overlays appear to float above the map. This does not happen when manually moving the map with touch; it only occurs when overlays are programmatically updated and the map is invalidated. Temporarily fixing the issue requires a slight zoom adjustment by the user or programmatically, which results in a brief incorrect display of the overlays before correcting itself.
Does anyone have any insights into this issue?
Environment
If it's a bug, version(s) of android this affects:
All
Version of osmdroid the issue relates to:
osmdroidAndroid = "6.1.18"
Zoom in my bounding box waiting that my ground being download :
Problem with one ground overlay:
Good placement :
The text was updated successfully, but these errors were encountered:
Hi, I'm Lucas, and I'm integrating osmdroid with Jetpack Compose in my project. I've encountered a peculiar issue with ground overlays that I believe is a bug.
Ground Overlay
[ ] Question
[X] Bug
[ ] Improvement
[ ] Build system related
[ ] Performance
[ ] Documentation
Description and/or steps/code to reproduce the problem
The issue doesn't manifest when the zoom level is set to 5 using Mapnik for France. However, on zooming into certain bounding boxes, my ground overlays occasionally do not align with the ground; instead, they appear to float above it.
Initial Setup
I use the zoomToBoundingBox function at the beginning to adjust the map view:
/** * Zoom the map to enclose the specified bounding box, as closely as possible. Must be called * after display layout is complete, or screen dimensions are not known, and will always zoom to * center of zoom level 0.<br> * Suggestion: Check getIntrinsicScreenRect(null).getHeight() > 0 */ public void zoomToBoundingBox(final BoundingBox boundingBox, final boolean animated) { zoomToBoundingBox(boundingBox, animated, 0); }
Fetching and Displaying Overlays
Upon receiving a list of ground overlays from an API call, I process them as follows:
LaunchedEffect(mapOrthomosaicData) { updateOrthomosaicOverlays( mapOrthomosaicData, mapOrthomosaicOverlays, overlayManagerState, mapViewViewModel, ) }
I add these ground overlays to the overlayManager and subsequently invalidate the map to refresh the display:
`fun updateOrthomosaicOverlays(
orthomosaicData: List,
overlays: Map<Int, Overlay>,
overlayManagerState: OverlayManagerState,
mapViewViewModel: MapViewEasyScanViewModel,
) {
val currentOverlays = overlays.keys.toSet()
}`
Issue
After calling invalidate(), some ground overlays appear to float above the map. This does not happen when manually moving the map with touch; it only occurs when overlays are programmatically updated and the map is invalidated. Temporarily fixing the issue requires a slight zoom adjustment by the user or programmatically, which results in a brief incorrect display of the overlays before correcting itself.
Does anyone have any insights into this issue?
Environment
If it's a bug, version(s) of android this affects:
All
Version of osmdroid the issue relates to:
osmdroidAndroid = "6.1.18"
Zoom in my bounding box waiting that my ground being download :
Problem with one ground overlay:
Good placement :
The text was updated successfully, but these errors were encountered: