public void GeoJsonWriterWrittenContentTest() { GeometryFactory factory = new GeometryFactory(); IMultiPolygon mp = factory.CreateMultiPolygon ( new List<IPolygon> { factory.CreatePolygon(factory.CreatePoint(10,10), factory.CreatePoint(20,10), factory.CreatePoint(25,17), factory.CreatePoint(10,10)), factory.CreatePolygon(factory.CreatePoint(50,30), factory.CreatePoint(40,20), factory.CreatePoint(20,10), factory.CreatePoint(25,17), factory.CreatePoint(30,30), factory.CreatePoint(50,30)) } ); Assert.AreEqual(2, mp.Count); IMultiPoint p = factory.CreateMultiPoint( new IPoint[2] { factory.CreatePoint(10,10), factory.CreatePoint(23,23) }); ILineString lstr = factory.CreateLineString( factory.CreatePoint(50,60), factory.CreatePoint(55,60), factory.CreatePoint(71,71) ); List<IGeometry> geo = new List<IGeometry>() { p, lstr }; string outFileName = _outputPath + ".geojson"; GeoJsonWriter writer = new GeoJsonWriter(outFileName); writer.Write(mp as IGeometry); writer.Write(geo); writer.Close(); GeoJsonReader reader = new GeoJsonReader(outFileName); IList<IGeometry> geometries = reader.ReadToEnd(); reader.Close(); GeometryComparer comp = new GeometryComparer(); Assert.AreEqual(0, comp.Compare(geometries[0], mp)); Assert.AreEqual(0, comp.Compare(geometries[1], p)); Assert.AreEqual(0, comp.Compare(geometries[2], lstr)); }
public void GeoJsonWriterWriteTest() { IList<IGeometry> geometries = null; byte i = 1; foreach (string path in _inputFilePaths) { GeoJsonReader reader = new GeoJsonReader(path); geometries = reader.ReadToEnd(); reader.Close(); string outFileName = _outputPath + i + ".geojson"; GeoJsonWriter writer = new GeoJsonWriter(outFileName); writer.Write(geometries); writer.Close(); i++; } }