mapbox / mapbox-unity-sdk

Mapbox Unity SDK - https://www.mapbox.com/unity/
Other
725 stars 210 forks source link

TileSize vs real world distance not matching #1868

Closed Markovicho closed 2 years ago

Markovicho commented 2 years ago

useful informations / sdk version

Settings in AbstractMap image

Scenario

image

Test setup

Expectation

Whats the result?

image image

I don't really get the issue here. Is there something fundamentally wrong in my assumptions or is this an bug in the framework? @brnkhy @Entryist

by the way setting the Scaling-Option to WorldScale results in gaps between the tiles: image

best regards and thanks in advance for any help

brnkhy commented 2 years ago

@Markovicho I should look into distance calculations properly some time but on top of my head, I think the difference here might be mercator meters vs real world meters. or in other words, impact of latitude on the distance calculations. a quick test for this might be trying it somewhere close to equator and then somewhere at extreme latitude.

Is that circle 90 units wide in unity space? maybe you can try to scale it by; Mathf.Cos(Mathf.Deg2Rad * (float)map.CenterLatitudeLongitude.x) If I'm not wrong, this was the latitude compensation formula 🤔

brnkhy commented 2 years ago

@Markovicho can you contact me via email; baran.kahyaoglu@mapbox.com or twitter brnkhy?

Markovicho commented 2 years ago

@Markovicho I should look into distance calculations properly some time but on top of my head, I think the difference here might be mercator meters vs real world meters. or in other words, impact of latitude on the distance calculations. a quick test for this might be trying it somewhere close to equator and then somewhere at extreme latitude.

Is that circle 90 units wide in unity space? maybe you can try to scale it by; Mathf.Cos(Mathf.Deg2Rad * (float)map.CenterLatitudeLongitude.x) If I'm not wrong, this was the latitude compensation formula 🤔

this did the trick. Fits now perfectly :-) thx @brnkhy