mapbox-maps-android
mapbox-maps-android copied to clipboard
Polygon breaks when zooming in
Environment
- Android OS version: Android 11
- Devices affected: Samsung S10+
- Maps SDK Version: 9.7.0, "com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0", Reproduced in v10 as well.
Reproduced on Emulator Pixel 4 API 29 as well.
Observed behavior and steps to reproduce
Add a hexagon with the following points, using the Plugin Annotation:
[[35.52482636074315,24.014679947948405],[35.51114716956354,24.01391178034676],[35.50374631403231,24.02820018964633],[35.51002341064811,24.043258382501087],[35.52370239640629,24.044030629840638],[35.53110449138368,24.02974060478422]]
This point is on Greece (but it doesn't matter you can add any hexagon you like). When zooming up to a certain point (<13 based on mapboxMap.cameraPosition.zoom
) everything is OK. As soon as you zoom >=13 the polygon breaks. If you zoom back to <13 it is OK etc etc. I have attached these two screenshots to understand the difference:
Correct Polygon:
Broken Polygon:
Expected behavior
The polygon should keep its format. The bounding points haven't changed at all.
Notes / preliminary analysis
Same thing happens with bigger polygons as well, after a certain zoom level they break.
Additional links and references
This could be reproduced in this branch locally. Guess it's related to gl-native, @pozdnyakov could you please take a look at this?
@Chaoba @pozdnyakov On this:
[[35.52482636074315,24.014679947948405],[35.51114716956354,24.01391178034676],[35.50374631403231,24.02820018964633],[35.51002341064811,24.043258382501087],[35.52370239640629,24.044030629840638],[35.53110449138368,24.02974060478422]]
Inserting the first point [35.52482636074315,24.014679947948405]
again at the end of the list, fixes the problem. If you try these points:
[[35.52482636074315,24.014679947948405],[35.51114716956354,24.01391178034676],[35.50374631403231,24.02820018964633],[35.51002341064811,24.043258382501087],[35.52370239640629,24.044030629840638],[35.53110449138368,24.02974060478422],[35.52482636074315,24.014679947948405]]
where the first and the last point are essentialy the same, that fixes the issue. But I think you might want to fix it on your source code.
Any news on that?? @tobrun
@PavlosTze Hi , i found a solution , you should use 20 points at least for drawing a polygon.
@tobrun and @Chaoba Why is this labeled as Blocked
? I identified that when I have 6 points, I should add a 7th one which will be identical to the 1st one in order for the Polygon to be "enclosed", but that looks more like a hacky solution to a bug IMO.