package cn.atide;
import org.gdal.gdal.gdal;
import org.gdal.ogr.DataSource;
import org.gdal.ogr.Driver;
import org.gdal.ogr.Layer;
import org.gdal.ogr.ogr;
import org.junit.Test;
/**
* 读取cad数据
* @author Administrator
*
*/
public class ReadDxf {
@Test
public void test() {
// 注册所有的驱动
ogr.RegisterAll();
gdal.SetConfigOption("GDAL_FILENAME_IS_UTF8","YES");
gdal.SetConfigOption("SHAPE_ENCODING","");
String strVectorFile = "E:\\gdalTest\\output\\财信.渝中城项目5#楼竣工.dxf";
DataSource ds = ogr.Open(strVectorFile,0);
if (ds == null)
{
System.out.println("打开文件失败!" );
return;
}
System.out.println("打开文件成功!" );
int iLayerCount = ds.GetLayerCount();
Layer oLayer = ds.GetLayerByIndex(0);
String name = oLayer.GetName();
if(oL
Gdal关于CAD转SHP格式
最新推荐文章于 2023-02-06 14:20:32 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)