mil.nga.geopackage.features.columns.GeometryColumns Java Examples
The following examples show how to use
mil.nga.geopackage.features.columns.GeometryColumns.
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 |
/** * 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: GeoPackageTextOutput.java From geopackage-java with MIT License | 6 votes |
/** * Build text from a feature table * * @param table * feature table * @return text */ public String featureTable(String table) { StringBuilder output = new StringBuilder(); FeatureDao featureDao = geoPackage.getFeatureDao(table); output.append("Table Name: " + featureDao.getTableName()); output.append("\nFeatures: " + featureDao.count()); GeometryColumns geometryColumns = featureDao.getGeometryColumns(); output.append("\n\nContents\n\n") .append(textOutput(geometryColumns.getContents())); output.append("\n\nGeometry Columns\n\n") .append(textOutput(geometryColumns)); return output.toString(); }
Example #3
Source File: GeoPackageTestUtils.java From geopackage-java with MIT License | 6 votes |
/** * 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 #4
Source File: GeoPackageTestUtils.java From geopackage-android with MIT License | 6 votes |
/** * 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 #5
Source File: GeoPackageImpl.java From geopackage-android with MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public FeatureDao getFeatureDao(Contents contents) { if (contents == null) { throw new GeoPackageException("Non null " + Contents.class.getSimpleName() + " is required to create " + FeatureDao.class.getSimpleName()); } GeometryColumns geometryColumns = contents.getGeometryColumns(); if (geometryColumns == null) { throw new GeoPackageException("No " + GeometryColumns.class.getSimpleName() + " exists for " + Contents.class.getSimpleName() + " " + contents.getId()); } return getFeatureDao(geometryColumns); }
Example #6
Source File: FeatureDao.java From geopackage-android with MIT License | 6 votes |
/** * Constructor * * @param database database name * @param db connection * @param geometryColumns geometry columns * @param table feature table */ public FeatureDao(String database, GeoPackageConnection db, GeometryColumns geometryColumns, FeatureTable table) { super(database, db, new FeatureConnection(db), table); this.featureDb = (FeatureConnection) getUserDb(); this.geometryColumns = geometryColumns; if (geometryColumns.getContents() == null) { throw new GeoPackageException(GeometryColumns.class.getSimpleName() + " " + geometryColumns.getId() + " has null " + Contents.class.getSimpleName()); } if (geometryColumns.getSrs() == null) { throw new GeoPackageException(GeometryColumns.class.getSimpleName() + " " + geometryColumns.getId() + " has null " + SpatialReferenceSystem.class.getSimpleName()); } projection = geometryColumns.getProjection(); }
Example #7
Source File: GeoPackageTestUtils.java From geopackage-android with MIT License | 6 votes |
/** * 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 #8
Source File: GeoPackageTestUtils.java From geopackage-android with MIT License | 6 votes |
/** * 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 #9
Source File: GeoPackageTestUtils.java From geopackage-android with MIT License | 6 votes |
/** * 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 #10
Source File: GeoPackageTestUtils.java From geopackage-java with MIT License | 6 votes |
/** * 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 #11
Source File: GeoPackageTestUtils.java From geopackage-java with MIT License | 6 votes |
/** * 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 #12
Source File: GeoPackageCoreImpl.java From geopackage-core-java with MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public GeometryColumns createFeatureTableWithMetadata( GeometryColumns geometryColumns, String idColumnName, List<FeatureColumn> additionalColumns, BoundingBox boundingBox, long srsId) { if (idColumnName == null) { idColumnName = "id"; } List<FeatureColumn> columns = new ArrayList<FeatureColumn>(); columns.add(FeatureColumn.createPrimaryKeyColumn(idColumnName)); columns.add(FeatureColumn.createGeometryColumn( geometryColumns.getColumnName(), geometryColumns.getGeometryType())); if (additionalColumns != null) { columns.addAll(additionalColumns); } return createFeatureTableWithMetadata(geometryColumns, boundingBox, srsId, columns); }
Example #13
Source File: GeoPackageDaoManager.java From geopackage-core-java with MIT License | 6 votes |
/** * Unregister all GeoPackage DAO with the connection source * * @param connectionSource * connection source */ public static void unregisterDaos(ConnectionSource connectionSource) { // TODO when ormlite-core version > 5.1 is released, replace with: // "DaoManager.unregisterDaos(connectionSource);" // See https://github.com/j256/ormlite-core/pull/149 unregisterDao(connectionSource, Contents.class, SpatialReferenceSystem.class, SpatialReferenceSystemSfSql.class, SpatialReferenceSystemSqlMm.class, Extensions.class, GriddedCoverage.class, GriddedTile.class, GeometryIndex.class, TableIndex.class, FeatureTileLink.class, ExtendedRelation.class, TileScaling.class, GeometryColumns.class, GeometryColumnsSfSql.class, GeometryColumnsSqlMm.class, Metadata.class, MetadataReference.class, DataColumns.class, DataColumnConstraints.class, TileMatrix.class, TileMatrixSet.class, ContentsId.class); }
Example #14
Source File: FeatureTileUtils.java From geopackage-java with MIT License | 6 votes |
/** * 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 #15
Source File: Contents.java From geopackage-core-java with MIT License | 6 votes |
/** * Get the Geometry Columns, should only return one or no value * * @return geometry columns */ public GeometryColumns getGeometryColumns() { GeometryColumns result = null; if (geometryColumns.size() > 1) { // This shouldn't happen with the unique table name constraint on // geometry columns throw new GeoPackageException( "Unexpected state. More than one GeometryColumn has a foreign key to the Contents. Count: " + geometryColumns.size()); } else if (geometryColumns.size() == 1) { CloseableIterator<GeometryColumns> iterator = geometryColumns .closeableIterator(); try { result = iterator.next(); } finally { try { iterator.close(); } catch (IOException e) { throw new GeoPackageException( "Failed to close the Geometry Columns iterator", e); } } } return result; }
Example #16
Source File: GeoPackageTestUtils.java From geopackage-java with MIT License | 6 votes |
/** * 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 #17
Source File: GeoPackageRepository.java From geopackage-mapcache-android with MIT License | 6 votes |
/** * 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 #18
Source File: FeatureDao.java From geopackage-java with MIT License | 6 votes |
/** * Constructor * * @param database * database name * @param db * GeoPackage connection * @param geometryColumns * geometry columns * @param table * feature table */ public FeatureDao(String database, GeoPackageConnection db, GeometryColumns geometryColumns, FeatureTable table) { super(database, db, new FeatureConnection(db), table); this.featureDb = (FeatureConnection) getUserDb(); this.geometryColumns = geometryColumns; if (geometryColumns.getContents() == null) { throw new GeoPackageException(GeometryColumns.class.getSimpleName() + " " + geometryColumns.getId() + " has null " + Contents.class.getSimpleName()); } if (geometryColumns.getSrs() == null) { throw new GeoPackageException(GeometryColumns.class.getSimpleName() + " " + geometryColumns.getId() + " has null " + SpatialReferenceSystem.class.getSimpleName()); } projection = geometryColumns.getProjection(); }
Example #19
Source File: GeoPackageTextOutput.java From geopackage-java with MIT License | 6 votes |
/** * Text output from a GeometryColumns * * @param geometryColumns * geometry columns * @return text */ public String textOutput(GeometryColumns geometryColumns) { StringBuilder output = new StringBuilder(); output.append("\t" + GeometryColumns.COLUMN_TABLE_NAME + ": " + geometryColumns.getTableName()); output.append("\n\t" + GeometryColumns.COLUMN_COLUMN_NAME + ": " + geometryColumns.getColumnName()); output.append("\n\t" + GeometryColumns.COLUMN_GEOMETRY_TYPE_NAME + ": " + geometryColumns.getGeometryTypeName()); output.append("\n" + textOutput(geometryColumns.getSrs())); output.append("\n\t" + GeometryColumns.COLUMN_Z + ": " + geometryColumns.getZ()); output.append("\n\t" + GeometryColumns.COLUMN_M + ": " + geometryColumns.getM()); return output.toString(); }
Example #20
Source File: GeoPackageCoreImpl.java From geopackage-core-java with MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public boolean createGeometryColumnsTable() { verifyWritable(); boolean created = false; GeometryColumnsDao dao = getGeometryColumnsDao(); try { if (!dao.isTableExists()) { created = tableCreator.createGeometryColumns() > 0; } } catch (SQLException e) { throw new GeoPackageException("Failed to check if " + GeometryColumns.class.getSimpleName() + " table exists and create it", e); } return created; }
Example #21
Source File: FeatureIndexManagerUtils.java From geopackage-android with MIT License | 5 votes |
/** * 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 #22
Source File: GeoPackageImpl.java From geopackage-java with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public FeatureDao getFeatureDao(String tableName) { GeometryColumnsDao dao = getGeometryColumnsDao(); List<GeometryColumns> geometryColumnsList; try { geometryColumnsList = dao .queryForEq(GeometryColumns.COLUMN_TABLE_NAME, tableName); } catch (SQLException e) { throw new GeoPackageException("Failed to retrieve " + FeatureDao.class.getSimpleName() + " for table name: " + tableName + ". Exception retrieving " + GeometryColumns.class.getSimpleName() + ".", e); } if (geometryColumnsList.isEmpty()) { throw new GeoPackageException( "No Feature Table exists for table name: " + tableName); } else if (geometryColumnsList.size() > 1) { // This shouldn't happen with the table name unique constraint on // geometry columns throw new GeoPackageException("Unexpected state. More than one " + GeometryColumns.class.getSimpleName() + " matched for table name: " + tableName + ", count: " + geometryColumnsList.size()); } return getFeatureDao(geometryColumnsList.get(0)); }
Example #23
Source File: GeoPackageCoreImpl.java From geopackage-core-java with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public GeometryColumns createFeatureTableWithMetadata( GeometryColumns geometryColumns, List<FeatureColumn> additionalColumns, BoundingBox boundingBox, long srsId) { return createFeatureTableWithMetadata(geometryColumns, null, additionalColumns, boundingBox, srsId); }
Example #24
Source File: GeoPackageImpl.java From geopackage-android with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public FeatureDao getFeatureDao(GeometryColumns geometryColumns) { if (geometryColumns == null) { throw new GeoPackageException("Non null " + GeometryColumns.class.getSimpleName() + " is required to create " + FeatureDao.class.getSimpleName()); } // Read the existing table and create the dao FeatureTableReader tableReader = new FeatureTableReader(geometryColumns); final FeatureTable featureTable = tableReader.readTable(database); featureTable.setContents(geometryColumns.getContents()); FeatureDao dao = new FeatureDao(getName(), database, geometryColumns, featureTable); // Register the table name (with and without quotes) to wrap cursors with the feature cursor registerCursorWrapper(geometryColumns.getTableName(), new GeoPackageCursorWrapper() { @Override public Cursor wrapCursor(Cursor cursor) { return new FeatureCursor(featureTable, cursor); } }); // If the GeoPackage is writable and the feature table has a RTree Index // extension, drop the RTree triggers. User defined functions are currently not supported. if (writable) { RTreeIndexExtension rtree = new RTreeIndexExtension(this); rtree.dropTriggers(featureTable); } return dao; }
Example #25
Source File: GeoPackageImpl.java From geopackage-android with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public FeatureDao getFeatureDao(String tableName) { GeometryColumnsDao dao = getGeometryColumnsDao(); List<GeometryColumns> geometryColumnsList; try { geometryColumnsList = dao.queryForEq( GeometryColumns.COLUMN_TABLE_NAME, tableName); } catch (SQLException e) { throw new GeoPackageException("Failed to retrieve " + FeatureDao.class.getSimpleName() + " for table name: " + tableName + ". Exception retrieving " + GeometryColumns.class.getSimpleName() + ".", e); } if (geometryColumnsList.isEmpty()) { throw new GeoPackageException( "No Feature Table exists for table name: " + tableName); } else if (geometryColumnsList.size() > 1) { // This shouldn't happen with the table name unique constraint on // geometry columns throw new GeoPackageException("Unexpected state. More than one " + GeometryColumns.class.getSimpleName() + " matched for table name: " + tableName + ", count: " + geometryColumnsList.size()); } return getFeatureDao(geometryColumnsList.get(0)); }
Example #26
Source File: FeatureIndexManagerUtils.java From geopackage-java with MIT License | 5 votes |
/** * 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 #27
Source File: SpatialReferenceSystemDao.java From geopackage-core-java with MIT License | 5 votes |
/** * Get or create a Geometry Columns DAO * * @return geometry columns dao * @throws SQLException * upon creation failure */ private GeometryColumnsDao getGeometryColumnsDao() throws SQLException { if (geometryColumnsDao == null) { geometryColumnsDao = DaoManager.createDao(connectionSource, GeometryColumns.class); } return geometryColumnsDao; }
Example #28
Source File: SpatialReferenceSystemDao.java From geopackage-core-java with MIT License | 5 votes |
/** * Delete the Spatial Reference System, cascading * * @param srs * spatial reference system * @return deleted count * @throws SQLException * upon deletion failure */ public int deleteCascade(SpatialReferenceSystem srs) throws SQLException { int count = 0; if (srs != null) { // Delete Contents ForeignCollection<Contents> contentsCollection = srs.getContents(); if (!contentsCollection.isEmpty()) { ContentsDao dao = getContentsDao(); dao.deleteCascade(contentsCollection); } // Delete Geometry Columns GeometryColumnsDao geometryColumnsDao = getGeometryColumnsDao(); if (geometryColumnsDao.isTableExists()) { ForeignCollection<GeometryColumns> geometryColumnsCollection = srs .getGeometryColumns(); if (!geometryColumnsCollection.isEmpty()) { geometryColumnsDao.delete(geometryColumnsCollection); } } // Delete Tile Matrix Set TileMatrixSetDao tileMatrixSetDao = getTileMatrixSetDao(); if (tileMatrixSetDao.isTableExists()) { ForeignCollection<TileMatrixSet> tileMatrixSetCollection = srs .getTileMatrixSet(); if (!tileMatrixSetCollection.isEmpty()) { tileMatrixSetDao.delete(tileMatrixSetCollection); } } // Delete count = delete(srs); } return count; }
Example #29
Source File: ContentsDao.java From geopackage-core-java with MIT License | 5 votes |
/** * Get or create a Geometry Columns DAO * * @return geometry columns dao * @throws SQLException * upon dao creation failure */ private GeometryColumnsDao getGeometryColumnsDao() throws SQLException { if (geometryColumnsDao == null) { geometryColumnsDao = DaoManager.createDao(connectionSource, GeometryColumns.class); } return geometryColumnsDao; }
Example #30
Source File: GeoPackageCoreImpl.java From geopackage-core-java with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public GeometryColumns createFeatureTableWithMetadata( GeometryColumns geometryColumns, BoundingBox boundingBox, long srsId) { return createFeatureTableWithMetadata(geometryColumns, null, null, boundingBox, srsId); }