To add a new, empty SQLite database table to which you can add spatial data later, first create a properties object with all required information.
Program: Create the properties object with the information required to create a table.
static Properties getProperties() {
Properties properties = new Properties();
// The basic database connection properties.
properties.put("driver", "org.sqlite.JDBC");
properties.put("url", "jdbc:sqlite:database.sqlite");
// The data of interest.
properties.put("table", "WORLD");
properties.put("spatialColumn", "GEOM");
// The feature columns to be decoded.
properties.put("featureNames.0", "COUNTRY");
properties.put("featureNames.1", "CAPITAL");
properties.put("featureNames.2", "POP_1994");
// Optional display names.
properties.put("featureDisplayNames.0", "Country");
properties.put("featureDisplayNames.1", "Capital");
properties.put("featureDisplayNames.2", "Population");
// The index of the feature that can be used as primary key.
properties.put("primaryFeatureIndex", "0");
properties.put("SRID", "4326");
// The regular SQL data types of the feature columns.
properties.put("featureDataTypes.0", "VARCHAR(30)");
properties.put("featureDataTypes.1", "VARCHAR(30)");
properties.put("featureDataTypes.2", "INTEGER");
// Careful with this option: it will drop the existing table (if any) when
// creating a new table (instead of failing with an SQL exception).
properties.put("dropBeforeCreatingTable", "false");
return properties;
}
Next, use this properties object to export an empty model, which creates the table.
Program: Create an empty SQLite table
TLcdSpatiaLiteModelEncoder encoder = new TLcdSpatiaLiteModelEncoder();
encoder.export(new TLcd2DBoundsIndexedModel(), getProperties());