ThinkGeo.com    |     Documentation    |     Premium Support

Overlay.FeatureSource.AddFeature not keeping column information

I am reading in shape information from my database and adding the features to an overlay. I am creating a dictionary of column names and values and when I create the feature add this to the call. But when I call to get all of the features for that layer I am not able to see the column information that was included when I created it. My code is below. Why is this data not being preserved?


 



// get query results rdr = cmd.ExecuteReader();
overlay.FeatureSource.Open();

// print the CustomerID of each record
if (rdr != null)
{
Dictionary columns;
while (rdr.Read())
{
columns = new Dictionary();
columns.Add("Country_Name", rdr[5].ToString());
columns.Add("RECID", rdr[0].ToString());
var baseShape = BaseShape.CreateShapeFromWellKnownData(rdr[16].ToString());
overlay.FeatureSource.BeginTransaction();
overlay.FeatureSource.AddFeature(baseShape, columns);
overlay.FeatureSource.CommitTransaction();
}
}

var list = overlay.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns);



Jeremy, 
  
 I guess that’s because you added column info for every feature, but didn’t add the column name to the header of the layer . 
  
              overlay.Columns.Add(new FeatureSourceColumn(“ColumnName”)); 
  
 Let me know if you have any issues. 
  
 Thanks, 
  
 Ben