mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
465 stars 131 forks source link

Polygon breaks when zooming in #733

Open PavlosTze opened 2 years ago

PavlosTze commented 2 years ago

Environment

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: 2

Broken Polygon: 1

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

Chaoba commented 2 years ago

This could be reproduced in this branch locally. Guess it's related to gl-native, @pozdnyakov could you please take a look at this?

PavlosTze commented 2 years ago

@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.

PavlosTze commented 2 years ago

Any news on that?? @tobrun

miladsalimiiii commented 2 years ago

@PavlosTze Hi , i found a solution , you should use 20 points at least for drawing a polygon.

PavlosTze commented 1 year ago

@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.

PavlosTze commented 2 weeks ago

Hello, @tobrun @Chaoba any news to that?