예제 #1
0
        public static decimal GetArea(FeatureCollection feats)
        {
            var features    = feats.Clone();
            var coordinate  = features.Features.FirstOrDefault().Geometry.Coordinates.FirstOrDefault();
            var zone        = 1 + (int)Math.Floor((coordinate.X + 180) / 6);
            var zoneIsNorth = (coordinate.Y * Math.PI / 180) < 0 ? false : true;

            features = TransformProjection(features, GeographicCoordinateSystem.WGS84, ProjectedCoordinateSystem.WGS84_UTM(zone, zoneIsNorth));

            decimal area = 0;

            foreach (var feature in features.Features)
            {
                for (var i = 0; i < feature.Geometry.NumGeometries; i++)
                {
                    area += (decimal)feature.Geometry.GetGeometryN(i).Area;
                }
            }
            return(area);
        }