Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[Android-iOS consistency] Zoom level vs ZoomLevel & Altitude mix #11676

Closed
Etienne-io opened this issue Apr 13, 2018 · 2 comments
Closed

[Android-iOS consistency] Zoom level vs ZoomLevel & Altitude mix #11676

Etienne-io opened this issue Apr 13, 2018 · 2 comments
Labels
Android Mapbox Maps SDK for Android archived Archived because of inactivity

Comments

@Etienne-io
Copy link

Hi there,

I found some issue opened requesting a public api to convert Altitude to ZoomLevel and ZoomLevel to Altitude.

I know that's possible and already wrote the code myself to work with iOS but, for consistency between iOS and Android and to make developer's life easier both should have the same behaviour and value in Camera object.

Android never talk about altitude and works only with zoom level when iOS use both depends on something that I don't understand :)

There is some reason for this ?

There is some project on your side about this ?

Etienne

@1ec5
Copy link
Contributor

1ec5 commented Jun 21, 2018

I found some issue opened requesting a public api to convert Altitude to ZoomLevel and ZoomLevel to Altitude.

Yes, #5583 would add that API to the iOS and macOS map SDKs.

Android never talk about altitude and works only with zoom level when iOS use both depends on something that I don't understand :)

One of our design goals on iOS and macOS is to adhere to Cocoa conventions, often using MapKit as an example of how Cocoa conventions apply to maps. MapKit’s API is 100% about altitudes and as opposed to zoom levels, but we use a hybrid approach to better accommodate developers used to the Google Maps SDK, GL JS, or our Android map SDK.

Whether altitudes or zoom levels are better when working with a 3D map depends on your use case. Zoom levels are tied to tiles, but on a 3D map, tiles are different sizes as you look closer or farther from the camera. Increasing the zoom level doesn’t just move the camera closer to the ground; it also moves the camera closer to the focal point, changing the center coordinate. So to be pedantic, zoomLevel should really be called viewingDistance. If you want to move the camera closer to the ground, then altitude is the better option to adjust. MGLMapCamera has two initializers that let you express the camera in terms of a) which way the viewer is looking or b) what the viewer is looking at.

On the other hand, if you need to move the camera to a particular zoom level because that’s the zoom level at which your style changes in appearance, then zoom levels are more relevant to you. #5583 would make it easier to work with either, depending on your needs. In the meantime, you can adjust the MGLMapView.zoomLevel property before or after setting the camera. An MGLMapCamera can avoid affecting the map’s altitude (or zoom level): set altitude to NAN or the current camera’s altitude.

Instead of closing this issue as a duplicate of #5583, I’m leaving this issue open in case the Android team would be interested in adding altitude as an alternative to zoom level when working with cameras.

/cc @tobrun

@asheemmamoowala asheemmamoowala added the Android Mapbox Maps SDK for Android label Dec 3, 2018
@stale stale bot added the archived Archived because of inactivity label Jun 1, 2019
@stale
Copy link

stale bot commented Jun 2, 2019

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Jun 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android archived Archived because of inactivity
Projects
None yet
Development

No branches or pull requests

3 participants