当前位置: 首页>>代码示例>>Java>>正文


Java GeoPackage类代码示例

本文整理汇总了Java中mil.nga.geopackage.GeoPackage的典型用法代码示例。如果您正苦于以下问题:Java GeoPackage类的具体用法?Java GeoPackage怎么用?Java GeoPackage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GeoPackage类属于mil.nga.geopackage包,在下文中一共展示了GeoPackage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUpImport

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * Set up the import database
 * 
 * @param activity
 * @param testContext
 * @return
 */
public static GeoPackage setUpImport(Activity activity, Context testContext) {

	GeoPackageManager manager = GeoPackageFactory.getManager(activity);

	// Delete
	manager.delete(TestConstants.IMPORT_DB_NAME);

	// Copy the test db file from assets to the internal storage
	TestUtils.copyAssetFileToInternalStorage(activity, testContext,
			TestConstants.IMPORT_DB_FILE_NAME);

	// Import
	String importLocation = TestUtils.getAssetFileInternalStorageLocation(
			activity, TestConstants.IMPORT_DB_FILE_NAME);
	manager.importGeoPackage(new File(importLocation));

	// Open
	GeoPackage geoPackage = manager.open(TestConstants.IMPORT_DB_NAME);
	if (geoPackage == null) {
		throw new GeoPackageException("Failed to open database");
	}

	return geoPackage;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:32,代码来源:TestSetupTeardown.java

示例2: getGeoPackage

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @throws IOException
 * @throws SQLException
 */
@Override
protected GeoPackage getGeoPackage() throws Exception {
	File testFolder = folder.newFolder();

	File testFile = TestUtils.getTestFile(file);

	File newFile = new File(testFolder, testFile.getName());
	try {
		GeoPackageIOUtils.copyFile(testFile, newFile);
	} catch (IOException e) {
		throw new GeoPackageException(
				"Failed to copy GeoPackage to test directory. File: "
						+ testFile.getAbsolutePath() + ", Test Directory: "
						+ testFolder.getAbsolutePath(), e);
	}

	// Open
	GeoPackage geoPackage = GeoPackageManager.open(newFile);
	if (geoPackage == null) {
		throw new GeoPackageException("Failed to open database");
	}

	return geoPackage;
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:31,代码来源:TilesGeoPackageTestCase.java

示例3: testCreateOpen

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * Test creating and opening a database
 * 
 * @throws IOException
 */
@Test
public void testCreateOpen() throws IOException {

	File testFolder = folder.newFolder();
	File dbFile = new File(testFolder, TestConstants.TEST_DB_FILE_NAME);

	// Create
	assertTrue("Database failed to create",
			GeoPackageManager.create(dbFile));
	assertTrue("Database does not exist", dbFile.exists());

	// Open
	GeoPackage geoPackage = GeoPackageManager.open(dbFile);
	assertNotNull("Failed to open database", geoPackage);
	geoPackage.close();

}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:23,代码来源:GeoPackageManagerTest.java

示例4: preTileGeneration

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void preTileGeneration() {

    // Link the feature and tile table if they are in the same GeoPackage
    GeoPackage geoPackage = getGeoPackage();
    String featureTable = featureTiles.getFeatureDao().getTableName();
    String tileTable = getTableName();
    if (linkTables && geoPackage.isFeatureTable(featureTable)
            && geoPackage.isTileTable(tileTable)) {
        FeatureTileTableLinker linker = new FeatureTileTableLinker(
                geoPackage);
        linker.link(featureTable, tileTable);
    }

}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:19,代码来源:FeatureTileGenerator.java

示例5: UrlTileGenerator

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * Constructor
 *
 * @param context     app context
 * @param geoPackage  GeoPackage
 * @param tableName   table name
 * @param tileUrl     tile url
 * @param minZoom     min zoom
 * @param maxZoom     max zoom
 * @param boundingBox tiles bounding box
 * @param projection  tiles projection
 * @since 1.3.0
 */
public UrlTileGenerator(Context context, GeoPackage geoPackage,
                        String tableName, String tileUrl, int minZoom, int maxZoom, BoundingBox boundingBox, Projection projection) {
    super(context, geoPackage, tableName, minZoom, maxZoom, boundingBox, projection);

    try {
        this.tileUrl = URLDecoder.decode(tileUrl, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        throw new GeoPackageException("Failed to decode tile url: "
                + tileUrl, e);
    }

    this.urlHasXYZ = hasXYZ(tileUrl);
    this.urlHasBoundingBox = hasBoundingBox(tileUrl);

    if (!this.urlHasXYZ && !this.urlHasBoundingBox) {
        throw new GeoPackageException(
                "URL does not contain x,y,z or bounding box variables: "
                        + tileUrl);
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:34,代码来源:UrlTileGenerator.java

示例6: testCreateFeatureTableWithMetadataIdColumnAdditionalColumns

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * 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()
			.createWebMercator();
	String idColumn = "my_other_id";
	geometryColumns = geoPackage.createFeatureTableWithMetadata(
			geometryColumns, idColumn, additionalColumns, boundingBox,
			srs.getId());

	validateFeatureTableWithMetadata(geoPackage, geometryColumns, idColumn,
			additionalColumns);
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:31,代码来源:GeoPackageTestUtils.java

示例7: getGeoPackage

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
@Override
protected GeoPackage getGeoPackage() throws Exception {

    GeoPackageManager manager = GeoPackageFactory.getManager(activity);

    // Delete
    manager.delete(TestConstants.IMPORT_ELEVATION_TILES_TIFF_DB_NAME);

    // Copy the test db file from assets to the internal storage
    TestUtils.copyAssetFileToInternalStorage(activity, testContext,
            TestConstants.IMPORT_ELEVATION_TILES_TIFF_DB_FILE_NAME);

    // Import
    String importLocation = TestUtils.getAssetFileInternalStorageLocation(
            activity, TestConstants.IMPORT_ELEVATION_TILES_TIFF_DB_FILE_NAME);
    manager.importGeoPackage(new File(importLocation));

    // Open
    GeoPackage geoPackage = manager.open(TestConstants.IMPORT_ELEVATION_TILES_TIFF_DB_NAME);
    if (geoPackage == null) {
        throw new GeoPackageException("Failed to open database");
    }

    return geoPackage;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:26,代码来源:ImportElevationTilesTiffGeoPackageTestCase.java

示例8: getGeoPackage

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
@Override
protected GeoPackage getGeoPackage() throws Exception {

    GeoPackageManager manager = GeoPackageFactory.getManager(activity);

    // Delete
    manager.delete(TestConstants.IMPORT_ELEVATION_TILES_DB_NAME);

    // Copy the test db file from assets to the internal storage
    TestUtils.copyAssetFileToInternalStorage(activity, testContext,
            TestConstants.IMPORT_ELEVATION_TILES_DB_FILE_NAME);

    // Import
    String importLocation = TestUtils.getAssetFileInternalStorageLocation(
            activity, TestConstants.IMPORT_ELEVATION_TILES_DB_FILE_NAME);
    manager.importGeoPackage(new File(importLocation));

    // Open
    GeoPackage geoPackage = manager.open(TestConstants.IMPORT_ELEVATION_TILES_DB_NAME);
    if (geoPackage == null) {
        throw new GeoPackageException("Failed to open database");
    }

    return geoPackage;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:26,代码来源:ImportElevationTilesGeoPackageTestCase.java

示例9: testCreateFeatureTableWithMetadata

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * 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()
			.createWebMercator();
	geometryColumns = geoPackage.createFeatureTableWithMetadata(
			geometryColumns, boundingBox, srs.getId());

	validateFeatureTableWithMetadata(geoPackage, geometryColumns, null,
			null);
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:26,代码来源:GeoPackageTestUtils.java

示例10: testCreateFeatureTableWithMetadataAdditionalColumns

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * 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()
			.createWebMercator();
	geometryColumns = geoPackage.createFeatureTableWithMetadata(
			geometryColumns, additionalColumns, boundingBox, srs.getId());

	validateFeatureTableWithMetadata(geoPackage, geometryColumns, null,
			additionalColumns);
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:28,代码来源:GeoPackageTestUtils.java

示例11: testCreateFeatureTableWithMetadataIdColumnAdditionalColumns

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * 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()
			.createWebMercator();
	String idColumn = "my_other_id";
	geometryColumns = geoPackage.createFeatureTableWithMetadata(
			geometryColumns, idColumn, additionalColumns, boundingBox,
			srs.getId());

	validateFeatureTableWithMetadata(geoPackage, geometryColumns, idColumn,
			additionalColumns);
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:31,代码来源:GeoPackageTestUtils.java

示例12: readTiles

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * Read the tiles in the directory into the GeoPackage file table
 * 
 * @param geoPackageFile
 *            GeoPackage file
 * @param tileTable
 *            tile table
 * @param directory
 *            input directory
 * @param imageFormat
 *            image format
 * @param tileType
 *            tile type
 * @param rawImage
 *            use raw image flag
 * @throws IOException
 * @throws SQLException
 */
public static void readTiles(File geoPackageFile, String tileTable,
		File directory, String imageFormat, TileFormatType tileType,
		boolean rawImage) throws IOException, SQLException {

	// If the GeoPackage does not exist create it
	if (!geoPackageFile.exists()) {
		if (!GeoPackageManager.create(geoPackageFile)) {
			throw new GeoPackageException(
					"Failed to create GeoPackage file: "
							+ geoPackageFile.getAbsolutePath());
		}
	}

	// Open the GeoPackage
	GeoPackage geoPackage = GeoPackageManager.open(geoPackageFile);
	try {
		readTiles(geoPackage, tileTable, directory, imageFormat, tileType,
				rawImage);
	} finally {
		geoPackage.close();
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:41,代码来源:TileReader.java

示例13: loadTiles

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * Load tiles from a URL
 *
 * @param activity
 * @param callback
 * @param active
 * @param database
 * @param tableName
 * @param tileUrl
 * @param minZoom
 * @param maxZoom
 * @param compressFormat
 * @param compressQuality
 * @param googleTiles
 * @param boundingBox
 * @param epsg
 */
public static void loadTiles(Activity activity, ILoadTilesTask callback,
                             GeoPackageDatabases active, String database, String tableName,
                             String tileUrl, int minZoom, int maxZoom,
                             CompressFormat compressFormat, Integer compressQuality,
                             boolean googleTiles, BoundingBox boundingBox, long epsg) {

    GeoPackageManager manager = GeoPackageFactory.getManager(activity);
    GeoPackage geoPackage = manager.open(database);

    Projection projection = ProjectionFactory.getProjection(epsg);
    BoundingBox bbox = transform(boundingBox, projection);

    TileGenerator tileGenerator = new UrlTileGenerator(activity, geoPackage,
            tableName, tileUrl, minZoom, maxZoom, bbox, projection);
    setTileGenerator(activity, tileGenerator, minZoom, maxZoom, compressFormat, compressQuality, googleTiles, boundingBox);

    loadTiles(activity, callback, active, geoPackage, tableName, tileGenerator);
}
 
开发者ID:ngageoint,项目名称:geopackage-mapcache-android,代码行数:36,代码来源:LoadTilesTask.java

示例14: preTileGeneration

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void preTileGeneration() {

	// Link the feature and tile table if they are in the same GeoPackage
	GeoPackage geoPackage = getGeoPackage();
	String featureTable = featureTiles.getFeatureDao().getTableName();
	String tileTable = getTableName();
	if (linkTables && geoPackage.isFeatureTable(featureTable)
			&& geoPackage.isTileTable(tileTable)) {
		FeatureTileTableLinker linker = new FeatureTileTableLinker(
				geoPackage);
		linker.link(featureTable, tileTable);
	}

}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:19,代码来源:FeatureTileGenerator.java

示例15: open

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * Open a GeoPackage
 * 
 * @param file
 * @return GeoPackage
 */
public static GeoPackage open(File file) {

	// Validate the file extension
	GeoPackageValidate.validateGeoPackageExtension(file);

	// Create the GeoPackage Connection and table creator
	GeoPackageConnection connection = connect(file);
	GeoPackageTableCreator tableCreator = new GeoPackageTableCreator(
			connection);

	// Create a GeoPackage
	GeoPackage geoPackage = new GeoPackageImpl(file, connection,
			tableCreator);

	// Validate the GeoPackage has the minimum required tables
	try {
		GeoPackageValidate.validateMinimumTables(geoPackage);
	} catch (RuntimeException e) {
		geoPackage.close();
		throw e;
	}

	return geoPackage;
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:31,代码来源:GeoPackageManager.java


注:本文中的mil.nga.geopackage.GeoPackage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。