Java Code Examples for mil.nga.geopackage.features.index.FeatureIndexManager#index()
The following examples show how to use
mil.nga.geopackage.features.index.FeatureIndexManager#index() .
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: GeoPackageExample.java From geopackage-android with MIT License | 5 votes |
private static void createGeometryIndexExtension(Context context, GeoPackage geoPackage) { List<String> featureTables = geoPackage.getFeatureTables(); for (String featureTable : featureTables) { FeatureDao featureDao = geoPackage.getFeatureDao(featureTable); FeatureIndexManager indexer = new FeatureIndexManager(context, geoPackage, featureDao); indexer.setIndexLocation(FeatureIndexType.GEOPACKAGE); indexer.index(); indexer.close(); } }
Example 2
Source File: FeatureTilesTest.java From geopackage-android with MIT License | 5 votes |
/** * Test feature tiles * * @throws java.sql.SQLException */ public void testFeatureTiles(boolean useIcon) throws SQLException { FeatureDao featureDao = FeatureTileUtils.createFeatureDao(geoPackage); int num = FeatureTileUtils.insertFeatures(geoPackage, featureDao); FeatureTiles featureTiles = FeatureTileUtils.createFeatureTiles(activity, geoPackage, featureDao, useIcon); try { FeatureIndexer indexer = new FeatureIndexer(activity, featureDao); try { indexer.index(); } finally { indexer.close(); } FeatureIndexManager indexManager = new FeatureIndexManager(activity, geoPackage, featureDao); featureTiles.setIndexManager(indexManager); indexManager.setIndexLocation(FeatureIndexType.GEOPACKAGE); int indexed = indexManager.index(); assertEquals(num, indexed); createTiles(featureTiles, 0, 3); } finally { featureTiles.close(); } }
Example 3
Source File: OAPIFeatureGeneratorTest.java From geopackage-android with MIT License | 4 votes |
/** * Test a WFS server and create a GeoPackage * * @param server server url * @param collection collection name * @param name geoPackage and table name * @param limit request limit * @param totalLimit total limit * @param boundingBox bounding box * @param time time * @param period period or end time * @throws SQLException upon error */ private void testServer(String server, String collection, String name, Integer limit, Integer totalLimit, BoundingBox boundingBox, String time, String period) throws SQLException { GeoPackageManager geoPackageManager = GeoPackageFactory.getManager(activity); geoPackageManager.delete(collection); geoPackageManager.create(collection); GeoPackage geoPackage = geoPackageManager.open(collection); OAPIFeatureGenerator generator = new OAPIFeatureGenerator( geoPackage, name, server, collection); generator.setLimit(limit); generator.setTotalLimit(totalLimit); generator.setBoundingBox(boundingBox); generator.setTime(time); generator.setPeriod(period); generator.setDownloadAttempts(3); int count = generator.generateFeatures(); if (totalLimit != null) { TestCase.assertEquals(totalLimit.intValue(), count); } FeatureDao featureDao = generator.getFeatureDao(); if (totalLimit != null) { TestCase.assertEquals(totalLimit.intValue(), featureDao.count()); } FeatureIndexManager indexer = new FeatureIndexManager(activity, geoPackage, featureDao); indexer.setIndexLocation(FeatureIndexType.GEOPACKAGE); indexer.index(); indexer.close(); BoundingBox dataBounds = geoPackage .getBoundingBox(featureDao.getTableName()); Contents contents = featureDao.getContents(); contents.setBoundingBox(dataBounds); geoPackage.getContentsDao().update(contents); geoPackage.close(); }