Thanks for quick reply. The problem is that I'm using UI markers manager and my markers don't inherit from OnlineMapsMarkerBase. I guess that is an important detail I've forgot to mention.
How can I convert longitude and latitude to the tile position?
EDIT. I can use map.projection.CoordinatesToTile I guess. I'll try it.
I'm getting wierd results. It moves the map to far-away place. My code:
public void CenterOnMarker(double latitude, double longitude, float offsetY = 0)
{
OnlineMaps map = OnlineMaps.instance;
Debug.Log("Map position before: " + map.position);
Debug.Log("Center on marker: " + latitude + " " + longitude + " offset: " + offsetY + " map zoom: " + map.zoom);
map.projection.CoordinatesToTile(latitude, longitude, map.zoom, out double tx, out double ty);
Debug.Log("tx: " + tx + " ty: " + ty + " tileSize: " + OnlineMapsUtils.tileSize);
ty -= offsetY / OnlineMapsUtils.tileSize;
map.SetTilePosition(tx, ty);
map.zoom = 14;
Debug.Log("Map position after: " + map.position);
}
The logs im getting:
Map position before: (16.95, 52.40)
Center on marker: 52,41 16,91 offset: 209,44 map zoom: 12
tx: 2644,31128645833 ty: 1852,74819069953 tileSize: 256
Map position after: (24.00, 49.00)