I want copy shapefile into postgis, and I use the command " ogr2ogr -f "PostgreSQL" PG:"dbname=db user=user password=pwd host=host port=port" -nln test -nlt PROMOTE_TO_MULTI "D:\spaceData\shp(1)\city_clip.shp" ". it wrok well. but i don't know "PROMOTE_TO_MULTI " how to set in java code
public static void main(String[] args) {
// Load GDAL library
gdal.AllRegister();
// Input File shp and PostGIS connection parameters
String filePath = "D:\\spaceData\\shp(1)\\city_clip.shp";
String postgisConnectionString = "PG:dbname=your_db user=user password=pwd " +
"host=host port=port";
// Open the File Geodatabase
DataSource fileDS = ogr.Open(filePath, 0);
// Open the PostGIS database
DataSource postgisDS = ogr.Open(postgisConnectionString, 1);
for (int i =0;i<fileDS.GetLayerCount();i++){
// Get the layer from the FileDS
Layer layer = fileDS.GetLayer(i);
Vector vec = new Vector();
// PROMOTE_TO_MULTI doesn't work
vec.add("PROMOTE_TO_MULTI=YES");
postgisDS.CopyLayer(layer,"test",vec);
}
// Close the data sourcesd
fileDS.delete();
postgisDS.delete();
}