private static IList <IGeometry> LoadWKT(String filename) { var rdr = new WKTReader(geomFact); var fileRdr = new WKTFileReader(filename, rdr); return(fileRdr.Read()); }
// here's how I generated coords.dat.gz (set TestDataPath and add references + usings, of course): #if false static void GenerateTestData() { const string TestDataPath = @"C:\Path\To\TestData"; var lst = new List <Coordinate>(); foreach (var fl in new[] { "africa.wkt", "europe.wkt", "world.wkt" }) { var wkt = new WKTFileReader(Path.Combine(TestDataPath, fl), new WKTReader()); lst.AddRange(wkt.Read().SelectMany(g => g.Coordinates)); } using (var writer = new BinaryWriter(new GZipStream(File.Create(Path.Combine(TestDataPath, "coords.dat.gz")), CompressionLevel.Optimal))) { writer.Write(lst.Count); foreach (var coord in lst) { writer.Write(coord.X); } foreach (var coord in lst) { writer.Write(coord.Y); } } }
public static IList <IGeometry> ReadWKTFile(String filename) { #if !PCL var fileRdr = new WKTFileReader(filename, reader); #else var fileRdr = new WKTFileReader(new BufferedStream(new FileStream(filename, FileMode.Open), 2048), reader); #endif var geoms = fileRdr.Read(); return(geoms); }
void PerformanceTest(Stream file) { var fileRdr = new WKTFileReader(new StreamReader(file), rdr); var polys = fileRdr.Read(); //RunAll(polys, 0.01); //RunAll(polys, 0.1); RunAll(polys, 1.0); //RunAll(polys, 10.0); //RunAll(polys, 100.0); //RunAll(polys, 1000.0); }
static void ReadWithCommas() { var wktReader = new WKTReader(); Console.WriteLine("With commas"); var reader = new WKTFileReader(linestringWithCommas, wktReader); // this doesn't affect the behaviour reader.Limit = -1; reader.Offset = 0; var geometries = reader.Read(); Console.WriteLine($"Count of geometries: {geometries.Count}"); }
static void ReadCollection() { var wktReader = new WKTReader(); Console.WriteLine("Collection"); var reader = new WKTFileReader(collection, wktReader); // this doesn't affect the behaviour reader.Limit = -1; reader.Offset = 0; var geometries = reader.Read(); Console.WriteLine($"Count of geometries: {geometries.Count}"); Console.WriteLine($"Count of sub geometries: {geometries.First().NumGeometries}"); }
private static void CheckInteriorPointFile(String file) { var fileRdr = new WKTFileReader(file, new WKTReader()); CheckInteriorPointFile(Path.GetFileName(file), fileRdr); }
public static List <Geometry> readWKTFile(Stream fileStream) { var fileRdr = new WKTFileReader(fileStream, new WKTReader()); return((List <Geometry>)fileRdr.Read()); }