.NET ShapeFile Writer utility class which provides the ability to create or edit shapefiles from .NET applications.
            
    Namespace: 
   EGIS.ShapeFileLibAssembly: EGIS.ShapeFileLib (in EGIS.ShapeFileLib.dll)
 Syntax
Syntax
| Visual Basic | 
|---|
| <ObfuscationAttribute(Exclude := True, ApplyToMembers := True)> _ Public MustInherit Class ShapeFileWriter _ Implements IDisposable | 
| C# | 
|---|
| [ObfuscationAttribute(Exclude = true, ApplyToMembers = true)] public abstract class ShapeFileWriter : IDisposable | 
| Visual C++ | 
|---|
| [ObfuscationAttribute(Exclude = true, ApplyToMembers = true)] public ref class ShapeFileWriter abstract : IDisposable | 
| JavaScript | 
|---|
| EGIS.ShapeFileLib.ShapeFileWriter = function(); Type.createClass( 'EGIS.ShapeFileLib.ShapeFileWriter', null, IDisposable); | 
 Remarks
Remarks
        
            ShapeFileWriter is an abstract class. To create an instance of ShapeFileWriter call the CreateWriter
            method or derive a new class by extending ShapeFileWriter
            
To use the ShapeFileWriter create a new instance by calling the CreateWriter method, passing in the shapefile path information, shape type and DBF field desricriptions. Progressively call the AddRecord method to add new records to the shapefile. Once all records have been added, close the shapefile by calling the Close method
Deriving classes must overload AddRecord.
IMPORTANT- When you have finished writing all records you must call Close.
All characters stored in DBF records use UTF-8 character encoding to support Unicode character sets
 Examples
Examples
 Example code to create a new shapefile using an existing shapefile and a ShapeFileWriter. 
            
|  Copy Code | |
|---|---|
| 
            public void CreateShapeFile()
            {
                ShapeFile sf = new ShapeFile("allroads.shp");
                DbfReader dbfReader = new DbfReader("allroads.dbf");
            
                //create a new ShapeFileWriter
                ShapeFileWriter sfw;
                sfw = ShapeFileWriter.CreateWriter(".", "highways", sf.ShapeType, 
                    dbfReader.DbfRecordHeader.GetFieldDescriptions());
                try
                {
                    // Get a ShapeFileEnumerator from the shapefile
                    // and read each record
                    ShapeFileEnumerator sfEnum = sf.GetShapeFileEnumerator();
                    while (sfEnum.MoveNext())
                    {
                        // get the raw point data
                        PointD[] points = sfEnum.Current[0];
                        //get the DBF record
                        string[] fields = dbfReader.GetFields(sfEnum.CurrentShapeIndex);
                        //check whether to add the record to the new shapefile.
                        //(in this example, field zero contains the road type)
                        if(string.Compare(fields[0].Trim(), "highway", true) == 0)
                        {
                            sfw.AddRecord(points, points.Length, fields);
                        }
                    }
                }
                finally
                {
                    //close the shapefile, shapefilewriter and dbfreader
                    sfw.Close(); 
                    sf.Close();
                    dbfReader.Close();
                }
            }
             | |
 Inheritance Hierarchy
Inheritance Hierarchy
System..::..Object
EGIS.ShapeFileLib..::..ShapeFileWriter
EGIS.ShapeFileLib..::..ShapeFileWriter
 
     
     
     
    