amay077 / Xamarin.Forms.GoogleMaps

Map library for Xamarin.Forms using Google maps API
https://www.nuget.org/packages/Xamarin.Forms.GoogleMaps/
MIT License
546 stars 346 forks source link

Create function to set position and zoom to show all markers #624

Closed juniorjrjl closed 5 years ago

juniorjrjl commented 5 years ago

SUMMARY

a google maps api have this function, you pass a array with coordinates and function calculates and set coordinates to show all markers

see about this in this link: (https://developers.google.com/maps/documentation/javascript/reference/map#Map.fitBounds)

DETAILS

In my job I'm developing a app who use map to show a vehicles' trackers in a map who refresh each 3 minutes, we use a function fitBounds in web application but I'm have problems in app. thak you :)

PLATFORMS

amay077 commented 5 years ago

You can use listed code.

Position[] positions = /* your pin's positions */;
Bounds bounds = Bounds.FromPositions(positions);
await map.MoveCamera(CameraUpdateFactory.NewBounds(bounds, 10));
juniorjrjl commented 5 years ago

It worked, thank you :)