0

我正在尝试将几何数据从数据集获取到特征数据集:

private void QueryCustomer(DataSet ds)
        {

            SharpMap.Data.FeatureDataSet ds_feature = new SharpMap.Data.FeatureDataSet();

            ds_feature = (SharpMap.Data.FeatureDataSet)ds;  // ERROR HERE
..

我正进入(状态 :

无法将“System.Data.DataSet”类型的对象转换为“SharpMap.Data.FeatureDataSet”类型

任何帮助,将不胜感激。谢谢。

4

1 回答 1

1

无需创建数据集。只需使用 FeatureDataSet 直接从 SqlLite 获取您的表:

double x, y;
FeatureDataSet fds = new FeatureDataSet();
Envelope env = new Envelope(double.MinValue, double.MaxValue, double.MinValue, double.MaxValue); 

SharpMap.Data.Providers.ManagedSpatiaLite p = new ManagedSpatiaLite(ConnectionString, Table, GeometryColumn.ToUpper(), KeyColumn.ToUpper()); 
p.Open();
p.ExecuteIntersectionQuery(env, fds);
foreach (FeatureDataRow fdr in ((FeatureDataTable)fds.Tables[0]).Rows)
{
x = fdr.Geometry.Centroid.X;
y = fdr.Geometry.Centroid.Y;
//...process x and y here...
}
p.Close();
p.Dispose();
于 2014-03-05T15:48:50.933 回答