-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Method for getting map camera settings from polyline, bearing, bounds and insets #9809
Comments
This sounds a lot like the existing Would it be desirable to automatically choose an optimal rotation (within some threshold, to avoid overrotation)? I recall that Bing's API even goes so far as to choose an optimal pitch when the map is tilted. |
This, I believe, is the tricky part. The viewport of the device in heading-up navigation is at an arbitrary bearing. You can't simply take the northeast and southwest coordinates and make a bounding box that will work. There needs to be some translation going on in order to calculate the proper zoom level. |
Could you explain the overrotation problem. As for the pitch, It would be really great to have that. |
|
I just meant that we may want to avoid rotating nearly 180° from the current camera just for something slightly more optimal than the current camera. |
This is great news. |
cc: @cammace @danesfeder for visibility on the Android side. |
This method should accept a polyline, a bearing, a bounding rectangle in pixels and an object defining padding in pixels on all sides. It should then return a center coordinate and a zoom level appropriate for showing the given polyline in the given bounds at the given bearing.
This is basically what's already happening in fitBounds. The only difference is that this returns the calculated values so that the developer can handle the fitting of the bounds using any transition they want.
cc @mapbox/gl @pveugen
The text was updated successfully, but these errors were encountered: