How to get current location or move to current location in Xamarin.Forms.Map
You will need to call MoveToRegion
method with the position you are interested in.
You can use Geolocator Plugin for Xamarin to get the location in PCL project:
var locator = CrossGeolocator.Current;
var position = await locator.GetPositionAsync(10000);
map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude, position. Longitude),
Distance.FromMiles(1)));
Updated: Xamarin Forms now includes by default Xamarin.Essentials: Geolocation
Center the map on your location:
var position = await locator.GetPositionAsync(5000);
map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude, position.Longitude), Distance.FromMiles(1))
Zoom the map on its current position:
var zoomLevel = 9; // between 1 and 18
var latlongdegrees = 360 / (Math.Pow(2, zoomLevel));
map.MoveToRegion(new MapSpan (map.VisibleRegion.Center, latlongdegrees, latlongdegrees));
Ref: https://developer.xamarin.com/guides/xamarin-forms/working-with/maps/