import org.gdal.ogr.*;
import org.gdal.gdal.*;classwriteShp2 {public static voidmain(String[] args) {
writeShp2 readshpObj= newwriteShp2();
readshpObj.WriteVectorFile();
}static voidWriteVectorFile() {
String strVectorFile= "D:\\test\\test.shp";
ogr.RegisterAll();
gdal.SetConfigOption("GDAL_FILENAME_IS_UTF8", "NO");
gdal.SetConfigOption("SHAPE_ENCODING", "CP936");
String strDriverName= "ESRI Shapefile";
org.gdal.ogr.Driver oDriver=ogr.GetDriverByName(strDriverName);if (oDriver == null) {
System.out.println(strVectorFile + "驱动不可用!\n");return;
}
DataSource oDS= oDriver.CreateDataSource(strVectorFile, null);if (oDS == null) {
System.out.println("创建矢量文件【" + strVectorFile + "】失败&#