private static IEnumerable <SuburbBoundary> GetBoundaries(IEnumerable <OpenDataSuburb> sameNameSuburbs) { var suburbList = sameNameSuburbs.ToList(); if (suburbList.Count <= 1) { return new[] { CreateSuburbBoundary(suburbList) } } ; var idSuburbs = suburbList.GroupBy(x => x.Id).Select(x => x.ToList()).ToList(); if (idSuburbs.Count <= 1) { return new[] { CreateSuburbBoundary(suburbList) } } ; var boundaries = idSuburbs.Select(suburbs => { var boundary = CreateSuburbBoundary(suburbs); return(LastUpdateTime: suburbs.First().UpdateDate, Boundary: boundary, GeoArea: GeoArea.FromGeoPoints(boundary.Boundary.Polygons.SelectMany(x => x))); }).OrderByDescending(x => x.LastUpdateTime); return(GetNoneOverlappedBoundaries(boundaries)); }
public void TestFromGeoPoints() { var area = GeoArea.FromGeoPoints(new[] { new GeoPoint(1, 2), new GeoPoint(2, 1), new GeoPoint(2, 3) }); Assert.AreEqual(new GeoPoint(1, 1), area.SouthWest); Assert.AreEqual(new GeoPoint(2, 3), area.NorthEast); }
private static GeoIndexes GetGeoIndexes(Boundary boundary, Distance resolution) { var area = GeoArea.FromGeoPoints(boundary.Polygons.Concat(boundary.ExcludePolygons).SelectMany(x => x)); return(new GeoIndexes(area.SouthWest, area.NorthEast, resolution)); }