GetProjection() public static method

Calculates gnomonic projection for geometric shapes on the surface of the ellipsoid.
public static GetProjection ( GeographyCollection collection ) : GnomonicProjection
collection GeographyCollection Collection of geometric shapes on the surface of the ellipsoid
return GnomonicProjection
        private ICollection <IGeography> calculateOverlay(IGeography geometry1, IGeography geometry2, OverlayType operation, bool p)
        {
            GeographyCollection egc = new GeographyCollection();

            egc.Add(geometry1);
            egc.Add(geometry2);

            GnomonicProjection projection = GeometrySpreader.GetProjection(egc);
            GeometryCollection gc         = GeometrySpreader.GetGeometries(egc, projection);

            OverlayCalculator       oc           = new OverlayCalculator();
            ICollection <IGeometry> planarResult = oc.CalculateOverlay(gc[0], gc[1], operation);

            egc = GeometrySpreader.GetGeographies(planarResult, projection);
            return(egc);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Computes a convex hull of the specified points.
        /// </summary>
        /// <param name="points">Enumerator of coordinates for which convex hull should be computed</param>
        /// <returns>A list containing a sequence of the convex hull points</returns>
        public static IList <GeoPoint> GetConvexHull(IEnumerable <GeoPoint> points)
        {
            GeographyCollection geographyCollection = new GeographyCollection();

            foreach (GeoPoint p in points)
            {
                geographyCollection.Add(p);
            }

            GnomonicProjection projection         = GeometrySpreader.GetProjection(geographyCollection);
            GeometryCollection geometryCollection = GeometrySpreader.GetGeometries(geographyCollection, projection);
            List <ICoordinate> list = new List <ICoordinate>();

            foreach (IGeometry g in geometryCollection)
            {
                list.Add(((PointD)g).Coordinate);
            }

            IList <ICoordinate> planarResult = PlanimetryAlgorithms.GetConvexHull(list);

            geometryCollection.Clear();
            foreach (ICoordinate p in planarResult)
            {
                geometryCollection.Add(new PointD(p));
            }

            geographyCollection = GeometrySpreader.GetGeographies(geometryCollection, projection);
            List <GeoPoint> result = new List <GeoPoint>();

            foreach (GeoPoint p in geographyCollection)
            {
                result.Add(p);
            }

            return(result);
        }