mapbox-maps-android icon indicating copy to clipboard operation
mapbox-maps-android copied to clipboard

Make possible to zoom to a FeatureCollection or a list of Points

Open gdgcentrica opened this issue 2 years ago • 4 comments

New Feature

Add on CameraBoundsOptions.Builder the possibility to zoom to bounds made by a FeatureCollection and/or by multiple Points. (If this feature already exists please make it clear on documentation)

Why

On v9 sdk it was possible to zoom to a LatLngBound builded by a list of LatLng, now in v10 sdk is impossible to do the same with Point and CoordinateBounds. Now if i want to display a route on map and zoom to it i don't know how to do it, so I think this is a feature that almost everyone needs.

gdgcentrica avatar Aug 05 '22 08:08 gdgcentrica

@gdgcentrica you can use the following methods to set the camera to a specific geometry or coordinates:

ZiZasaurus avatar Aug 13 '22 13:08 ZiZasaurus

@gdgcentrica you can use the following methods to set the camera to a specific geometry or coordinates:

cameraForCoordinates only takes a list of Points though. Would be great to have List<Geometry>

VincentJoshuaET avatar Aug 15 '22 03:08 VincentJoshuaET

@VincentJoshuaET if you use cameraForGeometry you can pass a line string or any geometry instead of a list of points.

ZiZasaurus avatar Aug 15 '22 21:08 ZiZasaurus

@ZiZasaurus thank you very much, it was exactly what i was searching for.

I think that this feature is important and needs to be highlighted here: Guides and/or here: Examples

gdgcentrica avatar Aug 16 '22 07:08 gdgcentrica

How to get CoordinateBounds, I want to get its east, west, north and south?

cattcal avatar Dec 01 '22 06:12 cattcal

After I use this I still need to zoom the correct amount. How I can zoom in the right amount to include two points (origin and destination) on android SDK V10?

At the moment I'm doing this:

val origin = Point.fromLngLat(lonOrigin, latOrigin)
val destination = Point.fromLngLat(lonDestination, latDestination)
val cameraOptions = binding.map.getMapboxMap().cameraForCoordinates(coordinates = listOf<Point>(origin, destination))
map.getMapboxMap().easeTo(cameraOptions)

It centers correctly but does not zoom in.

manuelsilverio avatar Mar 09 '23 23:03 manuelsilverio