You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"bounds" is an ill-defined concept in mapbox-gl-js due to pitch and rotation. A less ambiguous and more useful API would fit the map to an arbitrary GeoJSON feature.
"bounds" is an ill-defined concept in mapbox-gl-js due to pitch and rotation.
It doesn’t have to be: #1338. But a fitFeature feature would be useful too, by analogy with the -showAnnotations: function in the Mapbox iOS SDK that developers apparently prefer over -setVisibleCoordinateBounds: for many use cases.
A less ambiguous and more useful API would fit the map to an arbitrary GeoJSON feature.
How would fitFeature work? Would it try to auto-pick a bearing value that minimizes the bounding box around a feature? Or would it preserve the current bearing unless specified? The name fitFeature also doesn't fit the cases where you would pass it a GeoJSON geometry or a feature collection. Maybe fitData, by analogy with setData?
Ideally, it would minimize the bounding box around a feature while preserving the current bearing, but I don't think that's strictly necessary for this feature. Again for comparison, the iOS SDK fits to the unrotated bounding box when calling -showAnnotations: but you can get a more optimal fit by passing the feature's array of coordinates directly into -setVisibleCoordinates:count:. In either case, the current bearing is preserved.
Activity
1ec5 commentedon Mar 10, 2016
It doesn’t have to be: #1338. But a fitFeature feature would be useful too, by analogy with the
-showAnnotations:function in the Mapbox iOS SDK that developers apparently prefer over-setVisibleCoordinateBounds:for many use cases.[-]Replace fitBounds with fitFeature[/-][+]Add fitFeature method[/+]mourner commentedon Mar 11, 2016
How would
fitFeaturework? Would it try to auto-pick a bearing value that minimizes the bounding box around a feature? Or would it preserve the current bearing unless specified? The namefitFeaturealso doesn't fit the cases where you would pass it a GeoJSON geometry or a feature collection. MaybefitData, by analogy withsetData?1ec5 commentedon Mar 11, 2016
Ideally, it would minimize the bounding box around a feature while preserving the current bearing, but I don't think that's strictly necessary for this feature. Again for comparison, the iOS SDK fits to the unrotated bounding box when calling
-showAnnotations:but you can get a more optimal fit by passing the feature's array of coordinates directly into-setVisibleCoordinates:count:. In either case, the current bearing is preserved.iplanwebsites commentedon Nov 15, 2017
Do you have an idea of the timeline for this feature?