/// <summary> /// Creates a <see cref="ShapefileDataWriter"/> that appends to a shapefile instead of creating a new one. /// </summary> /// <param name="filename">The filename to append to.</param> /// <param name="factory">The Geometry factory to use.</param> public ShapefileDataWriter(string filename, GeometryFactory factory) { // appends _filename = filename; _shpWriter = new ShapefileWriter(filename, factory,true); _dbfWriter = new DbaseFileWriter(GetDbasefilename(_filename),true); }
/// <summary> /// Initializes a new instance of the <see cref="ShapefileDataWriter">ShapefileDataWriter</see> class. /// </summary> /// <param name="filename">The name of the file to write.</param> /// <param name="factory">The <b>GeometryFactory</b> to use.</param> /// <param name="fields">An <see cref="DbaseFieldDescriptor">DbaseFieldDescriptor[]</see> containing the data column definitions.</param> /// <remarks> /// The <see cref="ShapefileDataWriter.Close">Close</see> method must be called in order to update /// the underlying file headers. If <see cref="ShapefileDataWriter.Close">Close</see> is not called /// the underlying files may be in an invalid state. /// </remarks> public ShapefileDataWriter(string filename, GeometryFactory factory, DbaseFieldDescriptor[] fields) { _filename = filename; // This may need to have more logic to it to ensure we end up with the proper paths.... _shpWriter = new ShapefileWriter(_filename, factory); _dbfWriter = new DbaseFileWriter(GetDbasefilename(_filename)); for (int i = 0; i < fields.Length; i++) { _dbfWriter.AddColumn(fields[i]); } }
public static void WriteDummyDbf(string filename, int recordCount) { DbaseFileHeader dbfHeader = new DbaseFileHeader(); dbfHeader.AddColumn("row", 'N', 11, 0); DbaseFileWriter dbfWriter = new DbaseFileWriter(filename); dbfWriter.Write(dbfHeader); for (int i = 0; i < recordCount; i++) { ArrayList columnValues = new ArrayList(); columnValues.Add((double)i); dbfWriter.Write(columnValues); } dbfWriter.Close(); }
public static void WriteDummyDbf(string filename, int recordCount) { DbaseFileHeader dbfHeader = new DbaseFileHeader(); dbfHeader.AddColumn("row",'N',11,0); DbaseFileWriter dbfWriter = new DbaseFileWriter(filename); dbfWriter.Write(dbfHeader); for (int i=0; i < recordCount; i++) { ArrayList columnValues = new ArrayList(); columnValues.Add((double)i); dbfWriter.Write(columnValues); } dbfWriter.Close(); }