public async Task <List <Coordinate> > GenerateOptimizedRoute(Geofence geofence, double circleSize = 70) { // remove unused warn if (circleSize == (double)70) // default.. { //notting... } var polygon = geofence.Feature.Geometry.Coordinates; //var line = geometryFactory.CreateLineString(polygon); var bboxCoords = geofence.BBox.Coordinates; var minLat = bboxCoords.Min(x => x.X); var minLon = bboxCoords.Min(x => x.Y); var maxLat = bboxCoords.Max(x => x.X); var maxLon = bboxCoords.Max(x => x.Y); var bbox = new BoundingBox { MinimumLatitude = minLat, MinimumLongitude = minLon, MaximumLatitude = maxLat, MaximumLongitude = maxLon, }; var spawnpoints = (await _spawnpointsRepository.GetAllAsync().ConfigureAwait(false)).ToList(); var pokestops = await _pokestopRepository.GetAllAsync(bbox.MinimumLatitude, bbox.MinimumLongitude, bbox.MaximumLatitude, bbox.MaximumLongitude).ConfigureAwait(false); var gyms = await _gymRepository.GetAllAsync(bbox.MinimumLatitude, bbox.MinimumLongitude, bbox.MaximumLatitude, bbox.MaximumLongitude).ConfigureAwait(false); var cells = await _cellRepository.GetAllAsync(bbox.MinimumLatitude, bbox.MinimumLongitude, bbox.MaximumLatitude, bbox.MaximumLongitude).ConfigureAwait(false); var list = new List <Coordinate>(); spawnpoints.ForEach(x => list.Add(new Coordinate(x.Latitude, x.Longitude))); pokestops.ForEach(x => list.Add(new Coordinate(x.Latitude, x.Longitude))); gyms.ForEach(x => list.Add(new Coordinate(x.Latitude, x.Longitude))); //cells.ForEach(x => list.Add(new Coordinate(x.Latitude, x.Longitude))); var s2cells = GetS2Cells(bbox); list.AddRange(s2cells); // TODO: Filter if within geofence area return(list); }