shp导入不成功,试用的是PostgreSQL,表创建成功了,但是没有数据
String projectRootDir = System.getProperty("user.dir");
String targetFilePath = projectRootDir + File.separator + "data" +
File.separator + "shp" + File.separator + "xzqh.shp";
//导入shp文件
ImportSettingSHP importSettingSHP = new ImportSettingSHP();
//同名会覆盖
importSettingSHP.setImportMode(ImportMode.OVERWRITE);
//设置文件路径
importSettingSHP.setSourceFilePath(targetFilePath);
//设置需要导入的数据编码类型,因为有中文字段,所以用ASCII编码
//importSettingSHP.setSourceFileCharset(Charset.ANSI);
importSettingSHP.setTargetDatasetName("vector_plan");
//设置要导入的目标数据源
importSettingSHP.setTargetDatasource(datasource);
DataImport dataImport = new DataImport();
dataImport.getImportSettings().add(importSettingSHP);
dataImport.run();
iobject11,win10