async Task FetchAsync(MapRegion region) { const double MaxRadius = 20; Console.WriteLine($"Querying {lastFetch}"); AmenityNode[] nodes = null; var centerLat = 0.5 * (region.NearLeft.Latitude + region.FarRight.Latitude); var centerLng = 0.5 * (region.NearLeft.Longitude + region.FarRight.Longitude); if (MaxRadius < OverpassClient.GetDiameter(region.NearLeft.Latitude, region.NearLeft.Longitude, region.FarRight.Latitude, region.FarRight.Longitude)) { nodes = await client.SearchAmenityNodes(new[] { "recycling" }, centerLat, centerLng, MaxRadius); } else { nodes = await client.SearchAmenityNodes(new[] { "recycling" }, region.NearLeft.Latitude, region.NearLeft.Longitude, region.FarRight.Latitude, region.FarRight.Longitude); } foreach (var node in nodes) { Nodes[node.Id] = node; } var toVisualize = Nodes.Values.OrderBy(x => OverpassClient.GetDistance( centerLat, centerLng, x.Latitude, x.Longitude)).Take(1000).ToArray(); App.Instance.RunOnUI(() => { Items = toVisualize.Select(x => new Pin { Label = "Pin", Address = "Pin", Position = new Position(x.Latitude, x.Longitude) }).ToList(); UpdateProperties(); }); }