Rui,
Thanks for your post and questions, hope my following answer can give you some hints.
1.Yes, as you already guessed, the function GetFeaturesByColumnValue implemented in the base class FeatureSource will loop all features to get out the right features, the ShapeFileFeatureSource does not implement its own logic. So here up to now , I suggest you try to sue the SQL statement instead or implement the GetFeaturesByColumnValueCore to speed it up.
worldLayer1.Open();
DataTable table = worldLayer1.QueryTools.ExecuteQuery("select * from Countries02 where IDCOL='109920'");
worldLayer1.Close();
2. I am sorry to say that I could not recreate the problem you mentioned. I create a sample data with 2 records, the second record contains a null columnValue. And when I use the GetFeaturesByColumnValue to query, it works fine. I attached the data screenshot and the sample data. If you still have problem, could you send us the data? You can upload it in the discussion forum or send it to email forumsupport@thinkgeo.com and asked to forward to Yale
string shapeFile = @"C:\post7847Data.shp";
File.Delete(shapeFile);
File.Delete(shapeFile.Replace(".shp",".shx"));
File.Delete(shapeFile.Replace(".shp", ".dbf"));
File.Delete(shapeFile.Replace(".shp", ".idx"));
File.Delete(shapeFile.Replace(".shp", ".ids"));
DbfColumn dbfColumn1 = new DbfColumn("Column1", DbfColumnType.Integer, 10,0);
DbfColumn dbfColumn2 = new DbfColumn("Column2", DbfColumnType.String, 20,0);
ShapeFileFeatureSource.CreateShapeFile(ShapeFileType.Point, shapeFile, new DbfColumn[] { dbfColumn1, dbfColumn2 });
Feature feature1 = new Feature(50, 30, "1");
feature1.ColumnValues.Add("Column1", "1");
feature1.ColumnValues.Add("Column2", "ColumnValue1");
Feature feature2 = new Feature(80, 20, "2");
feature2.ColumnValues.Add("Column1", "2");
feature2.ColumnValues.Add("Column2", null);
ShapeFileFeatureSource shapeFileFeatureSource = new ShapeFileFeatureSource(shapeFile, ShapeFileReadWriteMode.ReadWrite);
shapeFileFeatureSource.Open();
shapeFileFeatureSource.BeginTransaction();
shapeFileFeatureSource.AddFeature(feature1);
shapeFileFeatureSource.AddFeature(feature2);
TransactionResult result = shapeFileFeatureSource.CommitTransaction();
shapeFileFeatureSource.Close();
if (result.TotalFailureCount > 0)
{
throw new InvalidOperationException("Error");
MessageBox.Show("Error");
}
ShapeFileFeatureLayer shapeFileFeatureLayer = new ShapeFileFeatureLayer(shapeFile, ShapeFileReadWriteMode.ReadOnly);
shapeFileFeatureLayer.Open();
Collection<Feature> features1 = shapeFileFeatureLayer.QueryTools.GetFeaturesByColumnValue("Column1", "1");
Collection<Feature> features2 = shapeFileFeatureLayer.QueryTools.GetFeaturesByColumnValue("Column2", "ColumnValue1");
shapeFileFeatureLayer.Close();
Any more questions just feel free to let me know.
Thanks.
Yale