Beispiel #1
0
        public static void SetDefaultView(this Map map)
        {
            var defaultMapCenter = new Position(40, -95);
            var defaultMapSpan   = MapSpan.FromCenterAndRadius(defaultMapCenter, Distance.FromMiles(500));

            map.MoveToRegion(defaultMapSpan);
        }
Beispiel #2
0
        public static async void CenterOnCurrentLocation(this Map map)
        {
            try
            {
                var currentLocation = await Geolocation.GetLastKnownLocationAsync();

                if (currentLocation == null)
                {
                    var locationRequest = new GeolocationRequest(GeolocationAccuracy.Medium);
                    currentLocation = await Geolocation.GetLocationAsync(locationRequest);
                }

                var currentPosition = new Position(currentLocation.Latitude, currentLocation.Longitude);
                var mapSpan         = MapSpan.FromCenterAndRadius(currentPosition, Distance.FromMiles(1));
                map.MoveToRegion(mapSpan);
            }
            catch (FeatureNotSupportedException fnsEx)
            {
                // Handle not supported on device exception
                return;
            }
            catch (PermissionException pEx)
            {
                // Handle permission exception
                return;
            }
            catch (Exception ex)
            {
                // Unable to get location
                return;
            }
        }
Beispiel #3
0
        async void GetCashPoints()
        {
            var location = await Geolocation.GetLastKnownLocationAsync();

            MyLat  = location.Latitude;
            MyLong = location.Longitude;

            CashPoints = await accountsManager.GetCashPointsAsync();

            CashPointsMap = new Xamarin.Forms.Maps.Map();

            if (CashPoints != null)
            {
                foreach (var cashpoint in CashPoints)
                {
                    // Place a pin on the map for each cash point
                    CashPointsMap.Pins.Add(new Pin
                    {
                        Type     = PinType.Place,
                        Label    = cashpoint.AccountName,
                        Position = new Position(cashpoint.Latitude, cashpoint.Longitude)
                    });
                }
            }
            // Center the map around the list of walks entry's location
            CashPointsMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(MyLat, MyLong), Distance.FromKilometers(1.0)));
        }
Beispiel #4
0
 //Move the Google API Map to a position on the map
 public void MoveTo()
 {
     if (map.VisibleRegion != null)
     {
         map.MoveToRegion(new MapSpan(position, position.Latitude, position.Longitude));
     }
 }
        private void Locator_PositionChanged(object sender, PositionEventArgs e)
        {
            var position = e.Position;

            dialogs.Toast($"{position.Latitude} | {position.Longitude}", TimeSpan.FromSeconds(1));

            var location = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var mapSpan  = MapSpan.FromCenterAndRadius(location, Distance.FromMeters(100));

            var lastPos = Model.Route.LastOrDefault();

            if (lastPos == null || (lastPos != null && Distance.BetweenPositions(location, lastPos).Meters > 5))
            {
                Model.AddPosition(location);
                viewMap.MapElements.Clear();
                var route = new Polyline()
                {
                    StrokeColor = Color.FromHex("#fc6203"),
                    StrokeWidth = 10
                };

                foreach (var pos in Model.Route)
                {
                    route.Geopath.Add(pos);
                }
                viewMap.MapElements.Add(route);
            }

            viewMap.MoveToRegion(mapSpan);
        }
Beispiel #6
0
        public async void GetLocation()
        {
            var location = await Geolocation.GetLastKnownLocationAsync();

            var position = new Position(location.Latitude, location.Longitude);

            map.MoveToRegion(MapSpan.FromCenterAndRadius(position, Distance.FromMiles(2.5)));
        }
Beispiel #7
0
        public async void GetCurrentLocation()
        {
            var position = await CrossGeolocator.Current.GetPositionAsync(TimeSpan.FromSeconds(1000));

            MainMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude, position.Longitude),
                                                             Distance.FromMiles(1)));
            Visible = true;
        }
Beispiel #8
0
        protected async void getCurrentLocation()
        {
            var locator  = CrossGeolocator.Current;
            var position = await locator.GetPositionAsync();

            map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude, position.Longitude),
                                                         Distance.FromMiles(3)));
        }
        public void InitializeMap(Xamarin.Forms.Maps.Map map)
        {
            map.MapType = MapType.Street;
            Position point   = new Position(37.334789, -121.888138);
            var      mapSpan = new MapSpan(point, 5, 5);

            map.MoveToRegion(mapSpan);
            map.Pins.Clear();
        }
Beispiel #10
0
 private async Task <MapSpan> MoveToRegionFromCenterAndRadius(Position currenPosition, int mapSearchDistanceInKM)
 {
     return(await Task.Run(() =>
     {
         MapSpan region = MapSpan.FromCenterAndRadius(currenPosition, Distance.FromKilometers(mapSearchDistanceInKM));
         map.MoveToRegion(region);
         return region;
     }));
 }
        async void MoveToCurrentLocation()
        {
            _currentLocation = await Geolocation.GetLocationAsync();

            Position _currentPos = new Position(_currentLocation.Latitude, _currentLocation.Longitude);

            _map.MoveToRegion(MapSpan.FromCenterAndRadius(_currentPos, Distance.FromMiles(1)));
            DrawRoute();
        }
Beispiel #12
0
        private async Task UpdateLocation()
        {
            try
            {
                var user = await DependencyService.Get <UserRepository>().GetUserAsync();

                var location = await Geolocation.GetLocationAsync();

                UserMap = new Map();
                if (location != null)
                {
                    var centerPosition = new Position(location.Latitude, location.Longitude);
                    UserMap.MoveToRegion(MapSpan.FromCenterAndRadius(centerPosition, Distance.FromKilometers(10)));

                    UserMap.Pins.Add(new Pin
                    {
                        Position = centerPosition,
                        Label    = "Ich"
                    });
                }

                var homeLocation = user?.HomeLocation;

                if (homeLocation != null)
                {
                    var homePosition = new Position(homeLocation.Latitude, homeLocation.Longitude);
                    UserMap.Pins.Add(new Pin
                    {
                        Position = homePosition,
                        Label    = "Zuhause"
                    });
                    if (location == null)
                    {
                        UserMap.MoveToRegion(MapSpan.FromCenterAndRadius(homePosition, Distance.FromKilometers(10)));
                    }
                }

                OnPropertyChanged(nameof(UserMap));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #13
0
 public void MoveTo()
 {
     if (map.VisibleRegion != null)
     {
         Console.WriteLine("***************************************");
         Console.WriteLine("Hello");
         Console.WriteLine("***************************************");
         map.MoveToRegion(new MapSpan(position, position.Latitude, position.Longitude));
     }
 }
Beispiel #14
0
        private async void FindMe()
        {
            Xamarin.Forms.Maps.Map map = this.FindByName <Xamarin.Forms.Maps.Map>("map");
            var locator = CrossGeolocator.Current;

            Plugin.Geolocator.Abstractions.Position position = new Plugin.Geolocator.Abstractions.Position();
            position = await locator.GetPositionAsync();

            map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude, position.Longitude), Distance.FromMiles(1)));
        }
Beispiel #15
0
        private async void SetLocation(object obj)
        {
            var request = new GeolocationRequest(GeolocationAccuracy.High, TimeSpan.FromSeconds(10));

            cts = new CancellationTokenSource();
            var location = await Geolocation.GetLocationAsync(request, cts.Token);

            if (location != null)
            {
                var newMap = new MapSpan(new Position(location.Latitude, location.Longitude), 0.01, 0.01);
                SetPin(Model.Name, PinType.Place, new Position(location.Latitude, location.Longitude));

                var customer = new Customer()
                {
                    Id = Model.Id, Location = $"{location.Latitude}, {location.Longitude}"
                };

                await Customers.UpdateLocation(customer);

                _map.MoveToRegion(newMap);
            }
        }
Beispiel #16
0
        async Task RunPin()
        {
            Map.Pins.Add(new Pin
            {
                Label = ""
            });

            var locator = await Geolocation.GetLastKnownLocationAsync();

            Map.Pins[0].Position = new Position(locator.Latitude, locator.Longitude);

            Map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(Map.Pins[0].Position.Latitude, Map.Pins[0].Position.Longitude), Distance.FromMiles(0.5)));
        }
        public void SetPinOnMap(Xamarin.Forms.Maps.Map map, string latitude, string longitude, string address)
        {
            Position position = new Position(double.Parse(latitude == null || latitude == "" ? "0" : latitude), double.Parse(longitude == null || longitude == "" ? "0" : longitude));

            map.MapType = MapType.Street;
            var mapSpan = new MapSpan(position, 0.001, 0.001);

            Pin pin = new Pin();

            pin.Label    = address;
            pin.Type     = PinType.SearchResult;
            pin.Position = position;

            map.MoveToRegion(mapSpan);
            map.Pins.Add(pin);
        }
        public void SetPinOnMap(Xamarin.Forms.Maps.Map map, Location location, string address)
        {
            Position position = new Position(location.Latitude, location.Longitude);

            map.MapType = MapType.Street;
            var mapSpan = new MapSpan(position, 0.001, 0.001);

            Pin pin = new Pin();

            pin.Label    = address;
            pin.Type     = PinType.SearchResult;
            pin.Position = position;

            map.MoveToRegion(mapSpan);
            map.Pins.Add(pin);
        }
Beispiel #19
0
        private async void Load()
        {
            tempats = await DataService.GetTempatAbsen();

            var request = new GeolocationRequest(GeolocationAccuracy.Medium, TimeSpan.FromSeconds(10));

            cts = new CancellationTokenSource();
            var location = await Geolocation.GetLocationAsync(request, cts.Token);

            if (location != null)
            {
                var newMap = new MapSpan(new Position(location.Latitude, location.Longitude), 0.01, 0.01);

                foreach (var item in tempats)
                {
                    var      position  = new Position(item.Tempat.Latitude, item.Tempat.Longitude);
                    Distance distance4 = Distance.BetweenPositions(new Position(location.Latitude, location.Longitude), position);
                    item.Distance = distance4;
                    Pin pin = new Pin
                    {
                        Label        = $"Distance {distance4.Meters} M",
                        Address      = $"{item.Tempat.Nama}, {item.Tempat.Address}",
                        Type         = PinType.Place,
                        AutomationId = item.TempatId.ToString(),
                        Position     = position
                    };

                    pin.Clicked += Pin_Clicked;
                    map.Pins.Add(pin);
                }

                if (tempats != null && tempats.Count() >= 0)
                {
                    var item = tempats.OrderBy(x => x.Distance.Meters).FirstOrDefault();
                    newMap = new MapSpan(new Position(item.Tempat.Latitude, item.Tempat.Longitude), 0.01, 0.01);
                }

                map.MoveToRegion(newMap);

                if (!CrossGeolocator.Current.IsListening)
                {
                    await CurrentPositon.StartListening();
                }
            }
        }
Beispiel #20
0
        public MapPage(IGeocoderService geocoderService, IPositionCalculatorService calculatorService, PlacesDataStore dataStore)
        {
            _geocoderService   = geocoderService;
            _dataStore         = dataStore;
            _calculatorService = calculatorService;
            addresses          = _dataStore.GetAllAddresses().ToList();

            if (!Compass.IsMonitoring)
            {
                Compass.Start(SensorSpeed.UI, true);
            }
            Compass.ReadingChanged += Compass_ReadingChanged;

            Title = "Map";

            Position position = new Position(50.450225, 30.461032);
            MapSpan  mapSpan  = new MapSpan(position, 0.01, 0.01);

            map = new Map();
            map.IsShowingUser    = true;
            map.HasScrollEnabled = true;
            map.HasZoomEnabled   = true;
            map.MoveToRegion(mapSpan);
            start = new Button {
                Text = "Start"
            };
            start.IsEnabled = true;
            go = new Button {
                Text = "Go"
            };
            go.IsEnabled = false;

            start.Clicked += Start_Clicked;

            Content = new StackLayout
            {
                Margin   = new Thickness(10),
                Children = { map }
            };
        }
Beispiel #21
0
        public static async void DisplayCurrentLoc(Map map)
        {
            try
            {
                var      request  = new GeolocationRequest(GeolocationAccuracy.Medium);
                Location location = await Geolocation.GetLocationAsync(request);

                if (location != null)
                {
                    Position userPosition = new Position(location.Latitude, location.Longitude);
                    map.MoveToRegion(MapSpan.FromCenterAndRadius(userPosition, Distance.FromKilometers(1)));
                }
            }
            catch (FeatureNotSupportedException fnsEx)
            {
                // Feature not supported on device
            }
            catch (Exception ex)
            {
                // Handle exception that may have occurred in geocoding
            }
        }
Beispiel #22
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            if (MyMap == null)
            {
                return;
            }
            var position = new Position(viewModel.Store.Latitude, viewModel.Store.Longitude); // Latitude, Longitude
            var pin      = new Pin
            {
                Type     = PinType.Place,
                Position = position,
                Label    = viewModel.Store.Name,
                Address  = viewModel.Store.StreetAddress
            };

            MyMap.Pins.Add(pin);

            MyMap.MoveToRegion(
                MapSpan.FromCenterAndRadius(
                    position, Distance.FromMiles(.2)));
        }
Beispiel #23
0
        async void ExecuteLoadPinsCommand()
        {
            List <string> adressList = currentProducts.Select(x => x.adress).Distinct().ToList();

            map.Pins.Clear();
            foreach (var adress in adressList)
            {
                map.Pins.Add(new Pin {
                    Label    = currentProducts.Where(x => x.adress == adress).Select(x => x.sellerName).First(),
                    Address  = adress,
                    Type     = PinType.Place,
                    Position = await MapService.getCoordinates(adress)
                });
            }

            foreach (Pin pin in map.Pins)
            {
                pin.InfoWindowClicked += async(obj, args) =>
                {
                    sB.Text = ((Pin)obj).Label;
                    await App.Current.MainPage.Navigation.PopToRootAsync();
                };
            }

            double south = map.Pins.Min(pin => pin.Position.Latitude);
            double north = map.Pins.Max(pin => pin.Position.Latitude);
            double west  = map.Pins.Min(pin => pin.Position.Longitude);
            double east  = map.Pins.Max(pin => pin.Position.Longitude);

            Position center = new Position((south + north) / 2, (west + east) / 2);

            Distance latidudinal  = Distance.BetweenPositions(new Position(north, center.Longitude), new Position(south, center.Longitude));
            Distance longitudinal = Distance.BetweenPositions(new Position(center.Latitude, west), new Position(center.Latitude, east));


            Distance radius = (latidudinal.Kilometers > longitudinal.Kilometers) ? latidudinal : longitudinal;

            map.MoveToRegion(MapSpan.FromCenterAndRadius(center, radius));
        }
Beispiel #24
0
        /// <summary>
        /// Gets the GPS location of the mobile device.
        /// </summary>
        /// <param name="map">The map object.</param>
        public async void GetLocation(Xamarin.Forms.Maps.Map map)
        {
            ShowLoadingDialog("Getting GPS location...");

            Location location = null;

            try
            {
                var request = new GeolocationRequest(GeolocationAccuracy.Best);
                location = await Geolocation.GetLocationAsync(request);

                // Move the map to the current location.
                Position position = new Position(location.Latitude, location.Longitude);
                map.MoveToRegion(MapSpan.FromCenterAndRadius(position, Distance.FromMeters(50)));

                // Add a marker to indicate the location.
                SetMarkerPosition(map, position);
            }
            catch (FeatureNotEnabledException)
            {
                HideLoadingDialog();
                await DisplayAlert("Location not enabled", "Location is disabled on the device. Please enable it to get the current position.");
            }
            catch (PermissionException)
            {
                HideLoadingDialog();
                await DisplayAlert("Location not allowed", "The app does not have permission to access location. Please add it to get the current position.");
            }
            catch (Exception)
            {
                HideLoadingDialog();
                await DisplayAlert("Error getting location", "Could not get the current location.");
            }

            HideLoadingDialog();

            Location = location;
        }
 void HandleLocationUpdated(object sender, Location e) =>
 Device.BeginInvokeOnMainThread(() => _map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(e.Latitude, e.Longitude), _distance)));
Beispiel #26
0
        void fill()
        {
            if (this.FullVenueData == null)
            {
                this.labelMetro.Text = "Couldn't load. Internet issues?";
                return;
            }

            this.panelAbout.Opacity            = 1;
            this.panelWithLargeButtons.Opacity = 1;
            this.buttonNewGameHost.IsVisible   = true;

            this.labelMetro.Text = string.IsNullOrEmpty(FullVenueData.Venue.MetroName) ? "-" : FullVenueData.Venue.MetroName;

            // about panel
            if (FullVenueData.Venue.IsInvalid)
            {
                this.panelInvalid.IsVisible = true;
                this.buttonPhoneNumber.Text = "-";
                this.buttonWebsite.Text     = "-";
                this.buttonDirections.Text  = "-";
            }
            else
            {
                this.panelInvalid.IsVisible = false;
                this.buttonPhoneNumber.Text = FullVenueData.Venue.HasPhoneNumber ? FullVenueData.Venue.PhoneNumber : "no phone #";
                string textWebsite = FullVenueData.Venue.HasWebsite ? FullVenueData.Venue.Website : "none";
                if (textWebsite.Length > 30)
                {
                    textWebsite = textWebsite.Substring(0, 30) + "...";
                }
                this.buttonWebsite.Text    = textWebsite;             // "website" : "no website";
                this.buttonDirections.Text = "Directions";
            }
            this.label10ftTables.Text = FullVenueData.Venue.NumberOf10fSnookerTables != null?FullVenueData.Venue.NumberOf10fSnookerTables.Value.ToString() : "?";

            this.label12ftTables.Text = FullVenueData.Venue.NumberOf12fSnookerTables != null?FullVenueData.Venue.NumberOf12fSnookerTables.Value.ToString() : "?";

            // community
            if (FullVenueData.Venue.LastContributorID > 0)
            {
                this.panelVerified.IsVisible       = true;
                this.panelNotVerifiedYet.IsVisible = false;
                this.labelVerifiedOn.Text          = DateTimeHelper.DateToString(FullVenueData.Venue.LastContributorDate.Value);       // FullVenueData.Venue.LastContributorDate.Value.ToShortDateString();
                this.labelVerifiedBy.Text          = FullVenueData.Venue.LastContributorName;
            }
            else
            {
                this.panelNotVerifiedYet.IsVisible = true;
                this.panelVerified.IsVisible       = false;
            }

            // map
            var    position       = new Xamarin.Forms.Maps.Position(FullVenueData.Venue.Latitude ?? 0, FullVenueData.Venue.Longitude ?? 0);
            double latlongdegrees = 0.01;

            map.MoveToRegion(new Xamarin.Forms.Maps.MapSpan(position, latlongdegrees, latlongdegrees));
            map.Pins.Clear();
            if (FullVenueData.Venue.Location != null)
            {
                var pin = new Pin
                {
                    Type     = PinType.Generic,
                    Position = position,
                    Label    = this.FullVenueData.Venue.Name,
                };
                pin.Clicked += (s1, e1) => { App.Navigator.OpenMapsApp(FullVenueData.Venue.Location, FullVenueData.Venue.Name, FullVenueData.Venue.Address); };
                map.Pins.Add(pin);
            }

            this.fillVisibleControlsWithExistingData();
        }
Beispiel #27
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();
            try
            {
                var request  = new GeolocationRequest(GeolocationAccuracy.Best, TimeSpan.FromSeconds(6));
                var location = await Geolocation.GetLocationAsync(request);

                //var location = await Geolocation.GetLastKnownLocationAsync();
                Xamarin.Forms.Maps.Position position = new Xamarin.Forms.Maps.Position(location.Latitude, location.Longitude);
                Xamarin.Forms.Maps.MapSpan  mapSpan  = new Xamarin.Forms.Maps.MapSpan(position, 0.01, 0.01);
                Xamarin.Forms.Maps.Map      map      = new Xamarin.Forms.Maps.Map(mapSpan)
                {
                    IsShowingUser = true
                };
                var latnow  = location.Latitude;
                var longnow = location.Longitude;
                reverseGeocodeEntry.Text = location.Latitude + "," + location.Longitude;
                //< x:Double x:Name = "latnow" ></ x:Double >
                //< x:Double x:Name = "longnow" ></ x:Double >
                Xamarin.Forms.Maps.Pin boardwalkPin = new Xamarin.Forms.Maps.Pin
                {
                    Label    = "U Plaza",
                    Address  = "The city with a KhonKean",
                    Type     = Xamarin.Forms.Maps.PinType.SearchResult,
                    Position = new Xamarin.Forms.Maps.Position(16.480157, 102.818123)
                               //16.43307340526658, 102.8255601788635  16.480157,102.818123
                };
                Xamarin.Forms.Maps.Pin boardwalkPin2 = new Xamarin.Forms.Maps.Pin
                {
                    Label    = "โจ๊กเผาหม้อ",
                    Address  = "โจ๊กกกกกกกก",
                    Type     = Xamarin.Forms.Maps.PinType.SearchResult,
                    Position = new Xamarin.Forms.Maps.Position(16.483848, 102.818624)
                               //16.43307340526658, 102.8255601788635  16.480157,102.818123
                };
                map.Pins.Add(boardwalkPin);
                map.Pins.Add(boardwalkPin2);
                Position positionx = new Position(location.Latitude, location.Longitude);
                map.MoveToRegion(new MapSpan(positionx, 0.1, 0.1));
                //this.mapapi = map;
                Content = map;

                //map.Pins.Add(new Pin
                //{
                //    Label = "Xamarin",
                //    Position = positionx
                //});
                //var polyline = new Xamarin.Forms.GoogleMaps.Polyline();
                //Xamarin.Forms.Maps.Pin pin = new Xamarin.Forms.Maps.Pin
                //{
                //    Type = PinType.Place,
                //    Position = new Position(16.480157, 102.818123),
                //    Label = "First",
                //    Address = "First",
                //    //Icon = Xamarin.Forms.GoogleMaps.BitmapDescriptorFactory.FromView(new Image() { Source = "ic_taxi.png", WidthRequest = 25, HeightRequest = 25 })
                //};
                //map.Pins.Add(pin);
            }
            catch (FeatureNotSupportedException fnsEx)
            {
                Console.WriteLine(fnsEx);
            }
            catch (FeatureNotEnabledException fneEx)
            {
                Console.WriteLine(fneEx);
            }
            catch (PermissionException pEx)
            {
                Console.WriteLine(pEx);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Beispiel #28
0
        async public void ShowCurrentLocationAsync(ILocation location)
        {
            var currentPOsition = await location.GetCurrentLocationCodinateAsync();

            _weatherMap.MoveToRegion(new MapSpan(new Position(currentPOsition.Item1, currentPOsition.Item2), 5, 5));
        }
Beispiel #29
0
        private async Task populateMap(List <Person> people)
        {
            mapLocsProperties.Clear();
            mapRef.Pins.Clear();
            double avgLat  = 0;
            double avgLong = 0;
            double minLat  = 90;
            double maxLat  = -90;
            double minLong = 180;
            double maxLong = -180;

            foreach (Person person in people)
            {
                //Person person = await DataStore.GetItemAsync(ids[0]);

                //Person person = people.FirstOrDefault(p => p.Id == id);
                string address = person.Address.ToString();
                try
                {
                    Location location = await GeocodeThis(address);

                    locs.Add(location);
                    Pin apin = new Pin()
                    {
                        Position = new Position(location.Latitude, location.Longitude),
                        Label    = person.Name
                    };
                    if (location.Latitude > maxLat)
                    {
                        maxLat = location.Latitude;
                    }
                    if (location.Latitude < minLat)
                    {
                        minLat = location.Latitude;
                    }
                    if (location.Longitude > maxLong)
                    {
                        maxLong = location.Longitude;
                    }
                    if (location.Longitude < minLong)
                    {
                        minLong = location.Longitude;
                    }
                    //avgLat += location.Latitude;
                    //avgLong += location.Longitude;
                    mapRef.Pins.Add(apin);
                    mapLocsProperties.Add(new MapLocation(address, person.Name, new Position(location.Latitude, location.Longitude)));
                    //TODO Map by name
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Exception:{ex} Outside Geocoding");
                }
            }
            var dist = Location.CalculateDistance(maxLat, maxLong, minLat, minLong, DistanceUnits.Kilometers) / 2;

            avgLat  = (maxLat - minLat) / 2 + minLat;
            avgLong = (maxLong - minLong) / 2 + minLong;

            Console.WriteLine("{maxLat}, {minLat}, {maxLong}, {minLong}, {dist}, {avgLat}, {avgLong}");
            Console.WriteLine($"{maxLat}, {minLat}, {maxLong}, {minLong}, {dist}, {avgLat}, {avgLong}");

            //avgLat /= mapLocsProperties.Count;
            //avgLong /= mapLocsProperties.Count;
            Console.WriteLine($"{avgLat}, {avgLong}, {mapLocsProperties.Count}");
            //new Position(avgLat, avgLong);mapLocsProperties[0].Position
            mapRef.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(avgLat, avgLong), Distance.FromKilometers(dist > 20?dist:20)));
            //Console.WriteLine($"Check Formating: \n{address}");
        }