mil.nga.geopackage.schema.TableColumnKey Java Examples

The following examples show how to use mil.nga.geopackage.schema.TableColumnKey. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FeatureTileUtils.java    From geopackage-android with MIT License 7 votes vote down vote up
/**
 * Create feature dao
 *
 * @return
 */
public static FeatureDao createFeatureDao(GeoPackage geoPackage) {

    BoundingBox boundingBox = new BoundingBox();

    GeometryColumns geometryColumns = new GeometryColumns();
    geometryColumns.setId(new TableColumnKey("feature_tiles",
            "geom"));
    geometryColumns.setGeometryType(GeometryType.GEOMETRY);
    geometryColumns.setZ((byte) 0);
    geometryColumns.setM((byte) 0);

    geoPackage.createFeatureTableWithMetadata(
            geometryColumns, boundingBox, ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);

    FeatureDao featureDao = geoPackage.getFeatureDao(geometryColumns);

    return featureDao;
}
 
Example #2
Source File: FeatureTileUtils.java    From geopackage-java with MIT License 6 votes vote down vote up
/**
 * Create feature dao
 *
 * @return feature dao
 */
public static FeatureDao createFeatureDao(GeoPackage geoPackage) {

	BoundingBox boundingBox = new BoundingBox();

	GeometryColumns geometryColumns = new GeometryColumns();
	geometryColumns.setId(new TableColumnKey(TABLE_NAME, "geom"));
	geometryColumns.setGeometryType(GeometryType.GEOMETRY);
	geometryColumns.setZ((byte) 0);
	geometryColumns.setM((byte) 0);

	geoPackage.createFeatureTableWithMetadata(geometryColumns, boundingBox,
			ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);

	FeatureDao featureDao = geoPackage.getFeatureDao(geometryColumns);

	return featureDao;
}
 
Example #3
Source File: GeometryColumnsSfSqlDao.java    From geopackage-core-java with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public GeometryColumnsSfSql queryForId(TableColumnKey key)
		throws SQLException {
	GeometryColumnsSfSql geometryColumns = null;
	if (key != null) {
		Map<String, Object> fieldValues = new HashMap<String, Object>();
		fieldValues.put(GeometryColumnsSfSql.COLUMN_F_TABLE_NAME,
				key.getTableName());
		fieldValues.put(GeometryColumnsSfSql.COLUMN_F_GEOMETRY_COLUMN,
				key.getColumnName());
		List<GeometryColumnsSfSql> results = queryForFieldValues(fieldValues);
		if (!results.isEmpty()) {
			if (results.size() > 1) {
				throw new SQLException("More than one "
						+ GeometryColumnsSfSql.class.getSimpleName()
						+ " returned for key. Table Name: "
						+ key.getTableName() + ", Column Name: "
						+ key.getColumnName());
			}
			geometryColumns = results.get(0);
		}
	}
	return geometryColumns;
}
 
Example #4
Source File: DataColumnsDao.java    From geopackage-core-java with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public DataColumns queryForId(TableColumnKey key) throws SQLException {
	DataColumns dataColumns = null;
	if (key != null) {
		Map<String, Object> fieldValues = new HashMap<String, Object>();
		fieldValues.put(DataColumns.COLUMN_TABLE_NAME, key.getTableName());
		fieldValues.put(DataColumns.COLUMN_COLUMN_NAME,
				key.getColumnName());
		List<DataColumns> results = queryForFieldValues(fieldValues);
		if (!results.isEmpty()) {
			if (results.size() > 1) {
				throw new SQLException(
						"More than one " + DataColumns.class.getSimpleName()
								+ " returned for key. Table Name: "
								+ key.getTableName() + ", Column Name: "
								+ key.getColumnName());
			}
			dataColumns = results.get(0);
		}
	}
	return dataColumns;
}
 
Example #5
Source File: GeometryColumnsSqlMmDao.java    From geopackage-core-java with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public GeometryColumnsSqlMm queryForId(TableColumnKey key)
		throws SQLException {
	GeometryColumnsSqlMm geometryColumns = null;
	if (key != null) {
		Map<String, Object> fieldValues = new HashMap<String, Object>();
		fieldValues.put(GeometryColumnsSqlMm.COLUMN_TABLE_NAME,
				key.getTableName());
		fieldValues.put(GeometryColumnsSqlMm.COLUMN_COLUMN_NAME,
				key.getColumnName());
		List<GeometryColumnsSqlMm> results = queryForFieldValues(fieldValues);
		if (!results.isEmpty()) {
			if (results.size() > 1) {
				throw new SQLException("More than one "
						+ GeometryColumnsSqlMm.class.getSimpleName()
						+ " returned for key. Table Name: "
						+ key.getTableName() + ", Column Name: "
						+ key.getColumnName());
			}
			geometryColumns = results.get(0);
		}
	}
	return geometryColumns;
}
 
Example #6
Source File: GeometryColumnsDao.java    From geopackage-core-java with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public GeometryColumns queryForId(TableColumnKey key) throws SQLException {
	GeometryColumns geometryColumns = null;
	if (key != null) {
		Map<String, Object> fieldValues = new HashMap<String, Object>();
		fieldValues.put(GeometryColumns.COLUMN_TABLE_NAME,
				key.getTableName());
		fieldValues.put(GeometryColumns.COLUMN_COLUMN_NAME,
				key.getColumnName());
		List<GeometryColumns> results = queryForFieldValues(fieldValues);
		if (!results.isEmpty()) {
			if (results.size() > 1) {
				throw new SQLException("More than one "
						+ GeometryColumns.class.getSimpleName()
						+ " returned for key. Table Name: "
						+ key.getTableName() + ", Column Name: "
						+ key.getColumnName());
			}
			geometryColumns = results.get(0);
		}
	}
	return geometryColumns;
}
 
Example #7
Source File: GeometryColumnsSfSqlDao.java    From geopackage-core-java with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int delete(GeometryColumnsSfSql data) throws SQLException {
	DeleteBuilder<GeometryColumnsSfSql, TableColumnKey> db = deleteBuilder();

	db.where()
			.eq(GeometryColumnsSfSql.COLUMN_F_TABLE_NAME,
					data.getFTableName())
			.and()
			.eq(GeometryColumnsSfSql.COLUMN_F_GEOMETRY_COLUMN,
					data.getFGeometryColumn());

	PreparedDelete<GeometryColumnsSfSql> deleteQuery = db.prepare();
	int deleted = delete(deleteQuery);
	return deleted;
}
 
Example #8
Source File: GeoPackageRepository.java    From geopackage-mapcache-android with MIT License 6 votes vote down vote up
/**
 * Create feature table in the given geopackage
 */
public boolean createFeatureTable(String gpName, BoundingBox boundingBox, GeometryType geometryType, String tableName){
    GeometryColumns geometryColumns = new GeometryColumns();
    geometryColumns.setId(new TableColumnKey(tableName,
            "geom"));
    geometryColumns.setGeometryType(geometryType);
    geometryColumns.setZ((byte) 0);
    geometryColumns.setM((byte) 0);

    GeoPackage geoPackage = manager.open(gpName);
    try {
        GeometryColumns created = geoPackage.createFeatureTableWithMetadata(
                geometryColumns, boundingBox, ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
        if(created != null) {
            return true;
        }
    } finally {
        geoPackage.close();
    }
    return false;
}
 
Example #9
Source File: GeoPackageTestUtils.java    From geopackage-java with MIT License 6 votes vote down vote up
/**
 * Test create feature table with metadata
 * 
 * @param geoPackage
 * @throws SQLException
 */
public static void testCreateFeatureTableWithMetadata(GeoPackage geoPackage)
		throws SQLException {

	GeometryColumns geometryColumns = new GeometryColumns();
	geometryColumns.setId(new TableColumnKey("feature_metadata", "geom"));
	geometryColumns.setGeometryType(GeometryType.POINT);
	geometryColumns.setZ((byte) 1);
	geometryColumns.setM((byte) 0);

	BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45);

	SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao()
			.getOrCreateCode(ProjectionConstants.AUTHORITY_EPSG,
					ProjectionConstants.EPSG_WEB_MERCATOR);
	geometryColumns = geoPackage.createFeatureTableWithMetadata(
			geometryColumns, boundingBox, srs.getId());

	validateFeatureTableWithMetadata(geoPackage, geometryColumns, null,
			null);
}
 
Example #10
Source File: GeoPackageTestUtils.java    From geopackage-java with MIT License 6 votes vote down vote up
/**
 * Test create feature table with metadata and id column
 * 
 * @param geoPackage
 * @throws SQLException
 */
public static void testCreateFeatureTableWithMetadataIdColumn(
		GeoPackage geoPackage) throws SQLException {

	GeometryColumns geometryColumns = new GeometryColumns();
	geometryColumns.setId(new TableColumnKey("feature_metadata2", "geom2"));
	geometryColumns.setGeometryType(GeometryType.POINT);
	geometryColumns.setZ((byte) 1);
	geometryColumns.setM((byte) 0);

	BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45);

	SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao()
			.getOrCreateCode(ProjectionConstants.AUTHORITY_EPSG,
					ProjectionConstants.EPSG_WEB_MERCATOR);
	String idColumn = "my_id";
	geometryColumns = geoPackage.createFeatureTableWithMetadata(
			geometryColumns, idColumn, boundingBox, srs.getId());

	validateFeatureTableWithMetadata(geoPackage, geometryColumns, idColumn,
			null);
}
 
Example #11
Source File: GeoPackageTestUtils.java    From geopackage-android with MIT License 6 votes vote down vote up
/**
 * Test create feature table with metadata, id column, and additional
 * columns
 *
 * @param geoPackage
 * @throws SQLException
 */
public static void testCreateFeatureTableWithMetadataIdColumnAdditionalColumns(
        GeoPackage geoPackage) throws SQLException {

    GeometryColumns geometryColumns = new GeometryColumns();
    geometryColumns.setId(new TableColumnKey("feature_metadata4", "geom4"));
    geometryColumns.setGeometryType(GeometryType.POINT);
    geometryColumns.setZ((byte) 1);
    geometryColumns.setM((byte) 0);

    BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45);

    List<FeatureColumn> additionalColumns = getFeatureColumns();

    SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao().getOrCreateCode(
            ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WEB_MERCATOR);
    String idColumn = "my_other_id";
    geometryColumns = geoPackage.createFeatureTableWithMetadata(
            geometryColumns, idColumn, additionalColumns, boundingBox,
            srs.getId());

    validateFeatureTableWithMetadata(geoPackage, geometryColumns, idColumn,
            additionalColumns);
}
 
Example #12
Source File: GeoPackageTestUtils.java    From geopackage-android with MIT License 6 votes vote down vote up
/**
 * Test create feature table with metadata and additional columns
 *
 * @param geoPackage
 * @throws SQLException
 */
public static void testCreateFeatureTableWithMetadataAdditionalColumns(
        GeoPackage geoPackage) throws SQLException {

    GeometryColumns geometryColumns = new GeometryColumns();
    geometryColumns.setId(new TableColumnKey("feature_metadata3", "geom3"));
    geometryColumns.setGeometryType(GeometryType.POINT);
    geometryColumns.setZ((byte) 1);
    geometryColumns.setM((byte) 0);

    BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45);

    List<FeatureColumn> additionalColumns = getFeatureColumns();

    SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao().getOrCreateCode(
            ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WEB_MERCATOR);
    geometryColumns = geoPackage.createFeatureTableWithMetadata(
            geometryColumns, additionalColumns, boundingBox, srs.getId());

    validateFeatureTableWithMetadata(geoPackage, geometryColumns, null,
            additionalColumns);
}
 
Example #13
Source File: GeoPackageTestUtils.java    From geopackage-android with MIT License 6 votes vote down vote up
/**
 * Test create feature table with metadata and id column
 *
 * @param geoPackage
 * @throws SQLException
 */
public static void testCreateFeatureTableWithMetadataIdColumn(
        GeoPackage geoPackage) throws SQLException {

    GeometryColumns geometryColumns = new GeometryColumns();
    geometryColumns.setId(new TableColumnKey("feature_metadata2", "geom2"));
    geometryColumns.setGeometryType(GeometryType.POINT);
    geometryColumns.setZ((byte) 1);
    geometryColumns.setM((byte) 0);

    BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45);

    SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao().getOrCreateCode(
            ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WEB_MERCATOR);
    String idColumn = "my_id";
    geometryColumns = geoPackage.createFeatureTableWithMetadata(
            geometryColumns, idColumn, boundingBox, srs.getId());

    validateFeatureTableWithMetadata(geoPackage, geometryColumns, idColumn,
            null);
}
 
Example #14
Source File: GeoPackageTestUtils.java    From geopackage-android with MIT License 6 votes vote down vote up
/**
 * Test create feature table with metadata
 *
 * @param geoPackage
 * @throws SQLException
 */
public static void testCreateFeatureTableWithMetadata(GeoPackage geoPackage)
        throws SQLException {

    GeometryColumns geometryColumns = new GeometryColumns();
    geometryColumns.setId(new TableColumnKey("feature_metadata", "geom"));
    geometryColumns.setGeometryType(GeometryType.POINT);
    geometryColumns.setZ((byte) 1);
    geometryColumns.setM((byte) 0);

    BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45);

    SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao().getOrCreateCode(
            ProjectionConstants.AUTHORITY_EPSG, ProjectionConstants.EPSG_WEB_MERCATOR);
    geometryColumns = geoPackage.createFeatureTableWithMetadata(
            geometryColumns, boundingBox, srs.getId());

    validateFeatureTableWithMetadata(geoPackage, geometryColumns, null,
            null);
}
 
Example #15
Source File: GeoPackageTestUtils.java    From geopackage-java with MIT License 6 votes vote down vote up
/**
 * Test create feature table with metadata and additional columns
 * 
 * @param geoPackage
 * @throws SQLException
 */
public static void testCreateFeatureTableWithMetadataAdditionalColumns(
		GeoPackage geoPackage) throws SQLException {

	GeometryColumns geometryColumns = new GeometryColumns();
	geometryColumns.setId(new TableColumnKey("feature_metadata", "geom"));
	geometryColumns.setGeometryType(GeometryType.POINT);
	geometryColumns.setZ((byte) 1);
	geometryColumns.setM((byte) 0);

	BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45);

	List<FeatureColumn> additionalColumns = getFeatureColumns();

	SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao()
			.getOrCreateCode(ProjectionConstants.AUTHORITY_EPSG,
					ProjectionConstants.EPSG_WEB_MERCATOR);
	geometryColumns = geoPackage.createFeatureTableWithMetadata(
			geometryColumns, additionalColumns, boundingBox, srs.getId());

	validateFeatureTableWithMetadata(geoPackage, geometryColumns, null,
			additionalColumns);
}
 
Example #16
Source File: GeoPackageTestUtils.java    From geopackage-java with MIT License 6 votes vote down vote up
/**
 * Test create feature table with metadata, id column, and additional
 * columns
 * 
 * @param geoPackage
 * @throws SQLException
 */
public static void testCreateFeatureTableWithMetadataIdColumnAdditionalColumns(
		GeoPackage geoPackage) throws SQLException {

	GeometryColumns geometryColumns = new GeometryColumns();
	geometryColumns.setId(new TableColumnKey("feature_metadata", "geom"));
	geometryColumns.setGeometryType(GeometryType.POINT);
	geometryColumns.setZ((byte) 1);
	geometryColumns.setM((byte) 0);

	BoundingBox boundingBox = new BoundingBox(-90, -45, 90, 45);

	List<FeatureColumn> additionalColumns = getFeatureColumns();

	SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao()
			.getOrCreateCode(ProjectionConstants.AUTHORITY_EPSG,
					ProjectionConstants.EPSG_WEB_MERCATOR);
	String idColumn = "my_other_id";
	geometryColumns = geoPackage.createFeatureTableWithMetadata(
			geometryColumns, idColumn, additionalColumns, boundingBox,
			srs.getId());

	validateFeatureTableWithMetadata(geoPackage, geometryColumns, idColumn,
			additionalColumns);
}
 
Example #17
Source File: FeatureIndexManagerUtils.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * Test large index
 *
 * @param activity    activity
 * @param geoPackage  GeoPackage
 * @param numFeatures num features
 * @param verbose     verbose printing
 * @throws SQLException upon error
 */
public static void testLargeIndex(Activity activity, GeoPackage geoPackage, int numFeatures,
                                  boolean verbose) throws SQLException {

    String featureTable = "large_index";

    GeometryColumns geometryColumns = new GeometryColumns();
    geometryColumns.setId(new TableColumnKey(featureTable, "geom"));
    geometryColumns.setGeometryType(GeometryType.POLYGON);
    geometryColumns.setZ((byte) 0);
    geometryColumns.setM((byte) 0);

    BoundingBox boundingBox = new BoundingBox(-180, -90, 180, 90);

    SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao()
            .getOrCreateCode(ProjectionConstants.AUTHORITY_EPSG,
                    ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
    List<FeatureColumn> additionalColumns = GeoPackageTestUtils
            .getFeatureColumns();
    geometryColumns = geoPackage.createFeatureTableWithMetadata(
            geometryColumns, additionalColumns, boundingBox, srs.getId());

    FeatureDao featureDao = geoPackage.getFeatureDao(geometryColumns);

    System.out.println();
    System.out.println("Inserting Feature Rows: " + numFeatures);
    TestUtils.addRowsToFeatureTable(geoPackage, geometryColumns,
            featureDao.getTable(), numFeatures, false, false, false);

    testTimedIndex(activity, geoPackage, featureTable, true, verbose);
}
 
Example #18
Source File: GeometryColumnsSfSqlDao.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int deleteIds(Collection<TableColumnKey> idCollection)
		throws SQLException {
	int count = 0;
	if (idCollection != null) {
		for (TableColumnKey id : idCollection) {
			count += deleteById(id);
		}
	}
	return count;
}
 
Example #19
Source File: GeometryColumnsSqlMmDao.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int updateId(GeometryColumnsSqlMm data, TableColumnKey newId)
		throws SQLException {
	int count = 0;
	GeometryColumnsSqlMm readData = queryForId(data.getId());
	if (readData != null && newId != null) {
		readData.setId(newId);
		count = update(readData);
	}
	return count;
}
 
Example #20
Source File: GeometryColumnsSqlMmDao.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int delete(GeometryColumnsSqlMm data) throws SQLException {
	DeleteBuilder<GeometryColumnsSqlMm, TableColumnKey> db = deleteBuilder();

	db.where()
			.eq(GeometryColumnsSqlMm.COLUMN_TABLE_NAME, data.getTableName())
			.and()
			.eq(GeometryColumnsSqlMm.COLUMN_COLUMN_NAME,
					data.getColumnName());

	PreparedDelete<GeometryColumnsSqlMm> deleteQuery = db.prepare();
	int deleted = delete(deleteQuery);
	return deleted;
}
 
Example #21
Source File: GeometryColumnsSqlMmDao.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int deleteById(TableColumnKey id) throws SQLException {
	int count = 0;
	if (id != null) {
		GeometryColumnsSqlMm geometryColumns = queryForId(id);
		if (geometryColumns != null) {
			count = delete(geometryColumns);
		}
	}
	return count;
}
 
Example #22
Source File: GeometryColumnsSqlMmDao.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int deleteIds(Collection<TableColumnKey> idCollection)
		throws SQLException {
	int count = 0;
	if (idCollection != null) {
		for (TableColumnKey id : idCollection) {
			count += deleteById(id);
		}
	}
	return count;
}
 
Example #23
Source File: DataColumnsDao.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int updateId(DataColumns data, TableColumnKey newId)
		throws SQLException {
	int count = 0;
	DataColumns readData = queryForId(data.getId());
	if (readData != null && newId != null) {
		readData.setId(newId);
		count = update(readData);
	}
	return count;
}
 
Example #24
Source File: DataColumnsDao.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int delete(DataColumns data) throws SQLException {
	DeleteBuilder<DataColumns, TableColumnKey> db = deleteBuilder();

	db.where().eq(DataColumns.COLUMN_TABLE_NAME, data.getTableName()).and()
			.eq(DataColumns.COLUMN_COLUMN_NAME, data.getColumnName());

	PreparedDelete<DataColumns> deleteQuery = db.prepare();
	int deleted = delete(deleteQuery);
	return deleted;
}
 
Example #25
Source File: DataColumnsDao.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int deleteById(TableColumnKey id) throws SQLException {
	int count = 0;
	if (id != null) {
		DataColumns dataColumns = queryForId(id);
		if (dataColumns != null) {
			count = delete(dataColumns);
		}
	}
	return count;
}
 
Example #26
Source File: DataColumnsDao.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int deleteIds(Collection<TableColumnKey> idCollection)
		throws SQLException {
	int count = 0;
	if (idCollection != null) {
		for (TableColumnKey id : idCollection) {
			count += deleteById(id);
		}
	}
	return count;
}
 
Example #27
Source File: FeatureIndexManagerUtils.java    From geopackage-java with MIT License 5 votes vote down vote up
/**
 * Test large index
 *
 * @param geoPackage
 *            GeoPackage
 * @param numFeatures
 *            num features
 * @param verbose
 *            verbose printing
 * @throws SQLException
 *             upon error
 */
public static void testLargeIndex(GeoPackage geoPackage, int numFeatures,
		boolean verbose) throws SQLException {

	String featureTable = "large_index";

	GeometryColumns geometryColumns = new GeometryColumns();
	geometryColumns.setId(new TableColumnKey(featureTable, "geom"));
	geometryColumns.setGeometryType(GeometryType.POLYGON);
	geometryColumns.setZ((byte) 0);
	geometryColumns.setM((byte) 0);

	BoundingBox boundingBox = new BoundingBox(-180, -90, 180, 90);

	SpatialReferenceSystem srs = geoPackage.getSpatialReferenceSystemDao()
			.getOrCreateCode(ProjectionConstants.AUTHORITY_EPSG,
					ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
	List<FeatureColumn> additionalColumns = GeoPackageTestUtils
			.getFeatureColumns();
	geometryColumns = geoPackage.createFeatureTableWithMetadata(
			geometryColumns, additionalColumns, boundingBox, srs.getId());

	FeatureDao featureDao = geoPackage.getFeatureDao(geometryColumns);

	System.out.println();
	System.out.println("Inserting Feature Rows: " + numFeatures);
	TestUtils.addRowsToFeatureTable(geoPackage, geometryColumns,
			featureDao.getTable(), numFeatures, false, false, false);

	testTimedIndex(geoPackage, featureTable, true, verbose);
}
 
Example #28
Source File: GeometryColumnsSfSqlDao.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int updateId(GeometryColumnsSfSql data, TableColumnKey newId)
		throws SQLException {
	int count = 0;
	GeometryColumnsSfSql readData = queryForId(data.getId());
	if (readData != null && newId != null) {
		readData.setId(newId);
		count = update(readData);
	}
	return count;
}
 
Example #29
Source File: GeometryColumnsSfSqlDao.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int deleteById(TableColumnKey id) throws SQLException {
	int count = 0;
	if (id != null) {
		GeometryColumnsSfSql geometryColumns = queryForId(id);
		if (geometryColumns != null) {
			count = delete(geometryColumns);
		}
	}
	return count;
}
 
Example #30
Source File: GeometryColumnsDao.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int deleteIds(Collection<TableColumnKey> idCollection)
		throws SQLException {
	int count = 0;
	if (idCollection != null) {
		for (TableColumnKey id : idCollection) {
			count += deleteById(id);
		}
	}
	return count;
}