1
        Gdal.AllRegister();
         //为了支持中文路径,请添加下面这句代码
        OSGeo.GDAL.Gdal.SetConfigOption("GDAL_FILENAME_IS_UTF8", "NO");
         //为了使属性表字段支持中文,请添加下面这句
        OSGeo.GDAL.Gdal.SetConfigOption("SHAPE_ENCODING", "");
        Ogr.RegisterAll();
        OSGeo.OGR.Driver outDriver = Ogr.GetDriverByName("GeoJSON");
        OSGeo.OGR.DataSource outDataSource =    outDriver.CreateDataSource("aaa.geojson",null);
        DataSource pnn3 = Ogr.Open("MSSQL:server=192.168.1.9,1433;database=KS_DataBase;UId=sa;PWD=sa", 0);

         OSGeo.OGR.Layer layer = pnn3.ExecuteSQL("select * from KS_HXStation", null, "");
        OSGeo.OGR.Feature f;
        layer.ResetReading();

mssql の空間データ転送 Geojson の取り方がわかりません。

4

2 に答える 2

0
var driver = Ogr.GetDriverByName("GeoJSON");
var trgPath = "";  //export geojson destination path
var trgDataset = driver.CreateDataSource(trgPath, null);
trgDataset.CopyLayer(layer, layer.GetName(), null);
trgDataset.Dispose();
于 2017-03-03T08:40:43.807 に答える