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

MoveToRegion not working #704

Open dalton5 opened 4 years ago

dalton5 commented 4 years ago

Hi,

I use the last version of XFGMaps.

I try to initialize the position with:

MapValue.MoveToRegion( MapSpan.FromCenterAndRadius( new Position(SearchInputValue.Place.Latitude, SearchInputValue.Place.Longitude) , new Distance(SearchInputValue.Radius)));

But nothing happens.

Then I tried to use as explained in other issues

MapValue.InitialCameraUpdate = CameraUpdateFactory.NewPosition(new Position(SearchInputValue.Place.Latitude, SearchInputValue.Place.Longitude));

It works well but I would like to show the map with a radius.

How can I set the zoom ratio to radius or to make working MoveToRegion?

Thanks,

dalton5 commented 4 years ago

OK I finally found the solution by checking the source code

`var ms = MapSpan.FromCenterAndRadius( new Position(SearchInputValue.Place.Latitude, SearchInputValue.Place.Longitude) , new Distance(SearchInputValue.Radius));

MapValue.InitialCameraUpdate = CameraUpdateFactory.NewBounds(ms.ToBounds(), 0);`

What does the padding mean for the method CameraUpdateFactory.NewBounds?

enkaradag commented 4 years ago

hi dalton5, im stuck at the same point. I have to zoom in deeper automatically, when a marker is selected.

could u find any solution?