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

How to fit multiple coordinates within the map with zoom

Open EmmanyTigaVentures opened this issue 10 months ago • 3 comments

Hi guys,

I really need help fitting all the Points (that has Positions) inside the Mapwidget.

Image

I tried this too but setting padding of 140 is too much and although its working but sometimes when i have different Points, they tend to not fit inside the map

Image

This is what i have done so far but its not working.

The image below is what is expected

Image

I've been on this for days and still can't figure it out.

EmmanyTigaVentures avatar Feb 02 '25 08:02 EmmanyTigaVentures

Hi, did you try the cameraForCoordinateBounds method? I think you were looking for this method.

Image

tchengck avatar Feb 04 '25 07:02 tchengck

Hi, did you try the cameraForCoordinateBounds method? I think you were looking for this method.

Image

Yeah it tried this but this only accepts 2 points southwest and northwest. In my case i can have more than 2 points.

TheinvinciblePrints avatar Feb 04 '25 10:02 TheinvinciblePrints

Then, you just need to determine the both points in advance. Like this (I haven't test it):

Image

tchengck avatar Feb 04 '25 10:02 tchengck