/// <summary>
        /// Converts a GeoJSON FeatureCollection to a list with data polygons.
        /// </summary>
        /// <param name="featureCollection">The GeoJSON FeatureCollection.</param>
        /// <returns>Converted polygons.</returns>
        public static List <DataPolygon> ConvertToDataPolygons(FeatureCollection featureCollection)
        {
            var dataPolygons = new List <DataPolygon>();

            if (featureCollection.IsNull())
            {
                return(dataPolygons);
            }

            foreach (Feature feature in featureCollection.Features)
            {
                ////if (feature.Type == GeoJSONObjectType.Polygon)
                if (feature.Geometry != null && feature.Geometry.GetType() == typeof(ArtDatabanken.GIS.GeoJSON.Net.Geometry.Polygon))
                {
                    ArtDatabanken.GIS.GeoJSON.Net.Geometry.Polygon polygon = (ArtDatabanken.GIS.GeoJSON.Net.Geometry.Polygon)feature.Geometry;
                    DataPolygon dataPolygon = ConvertToDataPolygon(polygon);
                    dataPolygons.Add(dataPolygon);
                }
                else if (feature.Geometry != null && feature.Geometry.GetType() == typeof(ArtDatabanken.GIS.GeoJSON.Net.Geometry.MultiPolygon))
                {
                    ArtDatabanken.GIS.GeoJSON.Net.Geometry.MultiPolygon multiPolygon = (ArtDatabanken.GIS.GeoJSON.Net.Geometry.MultiPolygon)feature.Geometry;
                    foreach (ArtDatabanken.GIS.GeoJSON.Net.Geometry.Polygon polygon in multiPolygon.Coordinates)
                    {
                        DataPolygon dataPolygon = ConvertToDataPolygon(polygon);
                        dataPolygons.Add(dataPolygon);
                    }
                }
            }

            return(dataPolygons);
        }
Esempio n. 2
0
 /// <summary>
 /// Determines whether the specified MultiPolygon is equal to this instance.
 /// </summary>
 /// <param name="other">The MultiPolygon to compare with this instance.</param>
 /// <returns>
 ///   <c>true</c> if the specified MultiPolygon is equal to this instance; otherwise, <c>false</c>.
 /// </returns>
 protected bool Equals(MultiPolygon other)
 {
     return(base.Equals(other) && Coordinates.SequenceEqualEx(other.Coordinates));
 }