ThinkGeo.com    |     Documentation    |     Premium Support

Saving car Trail from InMemoryFeatureLayer to ESRI shape file format

i'm trying to saving car Trail info from the example: 


DesktopEditionSample_BreadCrumbTrail_CS_100428


to shape file for view in ESRI ArcView


but i can't manage to do it.


 InMemoryFeatureLayer breadCrumbTrailInMemoryFeatureLayer = (InMemoryFeatureLayer)m_carOverlay.Layers["CarTrail"];

            System.Collections.ObjectModel.Collection<DbfColumn> cols = new System.Collections.ObjectModel.Collection<DbfColumn>();



            DbfColumn s = new DbfColumn("Spatial", DbfColumnType.String, 1, 0);

            cols.Add(s);



            ShapeFileFeatureLayer.CreateShapeFile(ShapeFileType.Multipoint, @"C:\Temp\TESTXX.shp", cols);

            ShapeFileFeatureLayer shapeFileLayer = new ShapeFileFeatureLayer(@"C:\Temp\TESTXX.shp", ShapeFileReadWriteMode.ReadWrite);

            shapeFileLayer.Open();

            try

            {

                

                shapeFileLayer.EditTools.BeginTransaction();

                foreach (var feature in breadCrumbTrailInMemoryFeatureLayer.InternalFeatures)

                {



                    shapeFileLayer.EditTools.Add(feature);

                }

                

                TransactionResult result = shapeFileLayer.EditTools.CommitTransaction();

                ShapeFileFeatureLayer.BuildIndexFile(@"C:\Temp\TESTXX.shp");

            }

            finally

            {

                shapeFileLayer.Close();

            }


please add some code sample...


10x



Hi Dsa, 
  
 There must be exceptions thrown from the try block, could you please remove the try finally block and provide the stack trace here? 
  
 Thanks, 
 Edgar