导出数据为矢量或栅格
string strDataSourceName = pListItem.Text; // 数据源名
string strSrcName = pListItem.SubItems[1].Text; // 数据集名
string strType = pListItem.SubItems[2].Text; // 输出类型
string strTargetName = pListItem.SubItems[3].Text; // 数据集新名
/// 数据源
soDataSource pSoDataSource = m_soDataSources[strDataSourceName];
if (pSoDataSource == null)
{
bFlag = false;
Marshal.ReleaseComObject(pSoDataSource); pSoDataSource = null;
continue;
}
/// 数据泵
soDataPump pSoDataPump = pSoDataSource.DataPump;
if (pSoDataPump == null)
{
bFlag = false;
Marshal.ReleaseComObject(pSoDataPump); pSoDataPump = null;
Marshal.ReleaseComObject(pSoDataSource); pSoDataSource = null;
continue;
}
string strExtention = Path.GetExtension(strType).Replace(")", "").Replace(".","").ToUpper();
switch (strExtention)
{
case "MIF":
pSoDataPump.FileType = seFileType.scfMIF;
strTargetName += ".mif";
break;
case "DXF":
pSoDataPump.FileType = seFileType.scfDXF;
strTargetName += ".dxf";
break;
case "DGN":
pSoDataPump.FileType = seFileType.scfDGN;
strTargetName += ".dgn";
break;
case "E00":
pSoDataPump.FileType = seFileType.scfE00;
strTargetName += ".e00";
break;
case "SHP":
pSoDataPump.FileType = seFileType.scfSHP;
strTargetName += ".shp";
break;
case "*.*": // COVERAGE文件
pSoDataPump.FileType = seFileType.scfCoverage;
break;
case "BMP":
pSoDataPump.FileType = seFileType.scfBMP;
strTargetName += ".bmp";
break;
case "JPG":
pSoDataPump.FileType = seFileType.scfJPG;
strTargetName += ".jpg";
break;
case "TIF":
pSoDataPump.FileType = seFileType.scfTIF;
strTargetName += ".tif";
break;
case "ECW":
pSoDataPump.FileType = seFileType.scfECW;
strTargetName += ".ecw";
break;
default:
continue;
}
pSoDataPump.DatasetToBeExported = strSrcName;
pSoDataPump.FileName = txtPath.Text + strTargetName;
pSoDataPump.DefaultUnits = seUnits.scuMeter;
if (!pSoDataPump.Export())
{
bFlag = false;
continue;
}
本文介绍了一种通过数据泵将地理信息系统(GIS)中的数据集导出为多种矢量或栅格格式的方法。支持的格式包括MIF、DXF、DGN、E00、SHP等矢量格式及BMP、JPG、TIF、ECW等栅格格式。文章详细展示了如何设置输出文件类型,并对每种格式进行了简要说明。

被折叠的 条评论
为什么被折叠?



