Пример #1
0
        public static LineString ToGeometry(this LinearRingType linearRing)
        {
            List<IPosition> positions;

            Type posType = linearRing.Items1ElementName.First().GetType();

            positions = FromGMLData(linearRing.Items1, Array.ConvertAll<Items1ChoiceType2, string>(linearRing.Items1ElementName, i => i.ToString()));

            LineString linestring = new LineString(positions);

            if (linestring.Positions.Count < 4 || !linestring.IsClosed())
                throw new InvalidFormatException("invalid GML representation: linearring is not a closed ring of minimum 4 positions");

            return linestring;
        }
Пример #2
0
        public static GeometryObject ToGeometry(this Terradue.GeoJson.GeoRss10.GeoRss10Polygon georssPolygon)
        {
            if (georssPolygon.Item == null)
                return null;

            Polygon polygon = new Polygon();

            polygon.LineStrings = new System.Collections.Generic.List<LineString>();

            LineString ls = new LineString(new DirectPositionListType(){ Text = georssPolygon.Item }.ToGeometry());

            if (ls.Positions.Count < 4 || !ls.IsClosed())
                throw new InvalidFormatException("invalid GML representation: linearring is not a closed ring of minimum 4 positions");

            polygon.LineStrings.Add(ls);

            return polygon;
        }