*/
DataSource dataSource = null;
Driver driver = ogr.GetDriverByName(outputFormat);
FieldDefn field = null;
Layer layer = null;
if (driver == null) {
System.err.println("Unable to find format driver named "
+ outputFormat);
System.exit(10);
}
dataSource = driver.CreateDataSource(outputFilename);
if (dataSource == null) {
System.exit(1);
}
if (threeDimension) {
layer = dataSource.CreateLayer(newLayerName, srs,
ogr.wkbLineString25D);
} else {
layer = dataSource
.CreateLayer(newLayerName, srs, ogr.wkbLineString);
}
if (layer == null) {
System.exit(1);
}
field = new FieldDefn("ID", ogr.OFTInteger);
field.SetWidth(8);
layer.CreateField(field, 0);
field.delete();
if (attributName != null) {
field = new FieldDefn(attributName, ogr.OFTReal);
field.SetWidth(12);
field.SetPrecision(3);
layer.CreateField(field, 0);
layer.delete();
}
/*
* Use terminal progress report
*/
if (quiet == false) {
progressCallback = new ProgressCallback();
}
/*
* Invoke.
*/
FeatureDefn feature = layer.GetLayerDefn();
gdal.ContourGenerate(band, contourInterval, offset, fixedLevelsDouble,
(ignoreNodata ? 1 : 0), sourceNodata, layer, feature.GetFieldIndex("ID"),
(attributName != null ? feature.GetFieldIndex(attributName) : -1),
progressCallback);