求sharpmap如何渲染MS SQL Server等格式的GIS数据? 我现在如何利用这两张表和sharpmap生成一张满足需求的地图? |
|
60分 |
1、加载Shapefile文件
public void LoadShapefile() //设置图层样式 //打开数据源 //重建索引 //添加图层到map中
2、加载PostGIS空间数据: 从PostGIS数据库中读取空间数据,利用了PostgreSqlClient类库,其操作方式和Shapefile类似 string sConn = “Server=127.0.0.1;Port=5432;User Id=postgres;Password=password;Database=PostGIS;”; PostGis.PostGisProvider oPostGIS = new PostGisProvider(sConn,sTableName,sUniqueId); ….. ….. (下面的操作和shapefile一样)
3、加载MsSQLServer空间数据: 从MsSQLServer数据库中读取空间数据,利用了MsSqlSpatial 类库,其操作方式和Shapefile类似 string sConnStr = @”Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|GeoDatabase.mdf;Integrated Security=True;User Instance=True”; SharpMap.Data.Providers.MsSql oMsSql = new SharpMap.Data.Providers.MsSql(ConnStr, “myTable”); SharpMap.Layers.GeometryLayer oGeometryLayer = new SharpMap.Layers.GeometryLayer(“postgis”, oMsSql ); ….. ….. (下面的操作和shapefile一样)
4、加载OracleSpatial空间数据 string sConnStr = “Server=127.0.0.1;Port=5432;User Id=userid;Password=password;Database=myGisDb;”; ….. ….. (下面的操作和shapefile一样)
5、加载MapInfo地图文件: 加载mapInfo图层利用了OGR类库 SharpMap.Layers.VectorLayer vLayerOgr = new SharpMap.Layers.VectorLayer(“MapInfoLayer”); ….. ….. (下面的操作和shapefile一样)
6、加载栅格图片 加载栅格图片利用了OGAL类库 GdalRasterLayer layGdal = new GdalRasterLayer(“Blue Marble”, @”C:datasrtm30plus.tif”); |