1

我正在尝试使用 SharpMap 在 Windows 窗体应用程序中呈现来自 SQL sever2008R2 的空间数据。下面是我尝试过的示例代码。每次我尝试运行代码时,我都会收到此错误消息,我需要分配 IGeometryServices 或实施 IGeometryService,因为 SharpMap 缺乏全面的文档,如果可能的话,请提供正确的方向

SharpMap.Layers.VectorLayer vlay = new SharpMap.Layers.VectorLayer("States");
        //vlay.DataSource = new SharpMap.Data.Providers.ShapeFile("d:\\+PMF\\GIS\\states_ugl.shp", true);

        SharpMap.Data.Providers.SqlServer2008 d = new SharpMap.Data.Providers.SqlServer2008(connectionString, "view1","geom","ID",SharpMap.Data.Providers.SqlServerSpatialObjectType.Geometry,false  ,4326  );
 mapBox1.Map.Layers.Add(vlay);
        mapBox1.Map.ZoomToExtents();
       // mapBox1.Map.BackColor = Color.BlueViolet;
        mapBox1.Refresh();
4

1 回答 1

-1

你试过了吗

SharpMap.Layers.VectorLayer vlay = new SharpMap.Layers.VectorLayer("States");
//vlay.DataSource = new SharpMap.Data.Providers.ShapeFile("d:\\+PMF\\GIS\\states_ugl.shp", true);

SharpMap.Data.Providers.SqlServer2008 d = new SharpMap.Data.Providers.SqlServer2008(connectionString, "view1","geom","ID",SharpMap.Data.Providers.SqlServerSpatialObjectType.Geometry,false  ,4326  );
vlay.DataSource = d;
mapBox1.Map.Layers.Add(vlay);
mapBox1.Map.ZoomToExtents();
// mapBox1.Map.BackColor = Color.BlueViolet;
mapBox1.Refresh();
于 2013-12-22T12:54:39.063 回答