Matt Matt - 1 year ago 1200
C# Question

How to get current location or move to current location in Xamarin.Forms.Map

Since the Map already shows the user location (with IsShowingUser) I just want to zoom to this location. Is this easily possible or do I need to get the location on every platform, since I don't find any GeoLocation object. Only the GeoCoder...
Is this not a common usecase to zoom to users position?

Answer Source

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 position = await locator.GetPositionAsync(10000);
map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude, position. Longitude), 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download