private static string GetGeometryUsingNTS(IGeometry geometry)
        {
            var gmlWriter = new GMLWriter();
            var ms = new MemoryStream();

            gmlWriter.Write(geometry, ms);
            return System.Text.Encoding.Default.GetString(ms.ToArray());
        }
        private static string GenerateTestFragment()
        {
            StringBuilder sb = new StringBuilder();
            XmlTextWriter writer = new XmlTextWriter(new StringWriter(sb));
            writer.WriteStartElement("test");
            writer.WriteAttributeString("xmlns", "gml", null, "http://www.opengis.net/gml");

            Point geom = new Point(52, -0.9);
            GMLWriter gmlWriter = new GMLWriter();
            gmlWriter.Write(geom, writer);

            writer.WriteEndElement();
            return sb.ToString();
        }
        public GMLTesting()
        {
            _point = Factory.CreatePoint(new Coordinate(100, 100));

            Coordinate[] coordinates =
            {
                new Coordinate(10,10),
                new Coordinate(20,20),
                new Coordinate(20,10)
            };
            _line = Factory.CreateLineString(coordinates);

            coordinates = new[]
            {
                new Coordinate(100,100),
                new Coordinate(200,100),
                new Coordinate(200,200),                
                new Coordinate(100,200),
                new Coordinate(100,100)
            };
            Coordinate[] interior1 =
            { 
                new Coordinate(120,120),
                new Coordinate(180,120),
                new Coordinate(180,180),                
                new Coordinate(120,180),
                new Coordinate(120,120)
            };
            ILinearRing linearRing = Factory.CreateLinearRing(coordinates);
            ILinearRing[] holes = { Factory.CreateLinearRing(interior1)};
            _polygon = Factory.CreatePolygon(linearRing, holes);

            coordinates = new[]
            {
                new Coordinate(100,100),
                new Coordinate(200,200),
                new Coordinate(300,300),                
                new Coordinate(400,400),
                new Coordinate(500,500)
            };
            _multiPoint = Factory.CreateMultiPoint(coordinates);

            _writer = new GMLWriter();
            _reader = new GMLReader();
        }
Beispiel #4
0
 /// <summary>
 /// Returns the feature representation as GML 2.1.1 XML document.
 /// This XML document is based on <c>Geometry.xsd</c> schema.
 /// NO features or XLink are implemented here!
 /// </summary>        
 public XmlReader ToGMLFeature()
 {
     GMLWriter writer = new GMLWriter();
     return writer.Write(this);
 }