addGeoPackageContentsEntry method
void
addGeoPackageContentsEntry()
Implementation
void addGeoPackageContentsEntry(
TableName tableName, int srid, String? description, Envelope? crsBounds) {
if (!hasCrs(srid))
throw new IOException(
"The srid is not yet present in the package. Please add it before proceeding.");
// final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(DATE_FORMAT_STRING);
// DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT"));
StringBuffer sb = new StringBuffer();
StringBuffer vals = new StringBuffer();
sb.write(
"INSERT INTO $TABLE_GEOPACKAGE_CONTENTS (table_name, data_type, identifier");
vals.write("VALUES (?,?,?");
if (description == null) {
description = "";
}
sb.write(", description");
vals.write(",?");
sb.write(", min_x, min_y, max_x, max_y");
vals.write(",?,?,?,?");
sb.write(", srs_id");
vals.write(",?");
sb.write(") ");
vals.write(")");
sb.write(vals.toString());
double minx = 0;
double miny = 0;
double maxx = 0;
double maxy = 0;
if (crsBounds != null) {
minx = crsBounds.getMinX();
miny = crsBounds.getMinY();
maxx = crsBounds.getMaxX();
maxy = crsBounds.getMaxY();
}
_sqliteDb.execute(sb.toString(), arguments: [
tableName.name,
DataType.Feature.value,
tableName.name,
description,
minx,
miny,
maxx,
maxy,
srid
]);
}