• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GeoPackage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: infoFeatureClick

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * Info feature click
 *
 * @param marker
 * @param markerFeature
 */
private void infoFeatureClick(final Marker marker, MarkerFeature markerFeature) {
    final GeoPackage geoPackage = manager.open(markerFeature.database);
    final FeatureDao featureDao = geoPackage
            .getFeatureDao(markerFeature.tableName);

    final FeatureRow featureRow = featureDao.queryForIdRow(markerFeature.featureId);

    if (featureRow != null) {
        final GeoPackageGeometryData geomData = featureRow.getGeometry();
        final GeometryType geometryType = geomData.getGeometry()
                .getGeometryType();

        String title = getTitle(geometryType, marker);
        infoExistingFeatureOption(geoPackage, featureRow, title, geomData);
    } else {
        geoPackage.close();
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-mapcache-android,代码行数:25,代码来源:GeoPackageMapFragment.java


示例17: 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_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();
	geometryColumns = geoPackage.createFeatureTableWithMetadata(
			geometryColumns, additionalColumns, boundingBox, srs.getId());

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


示例18: createFeatureDao

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:23,代码来源:FeatureTileUtils.java


示例19: tearDownCreate

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * Tear down the create database
 * 
 * @param activity
 * @param geoPackage
 */
public static void tearDownCreate(Activity activity, GeoPackage geoPackage) {

	// Close
	if (geoPackage != null) {
		geoPackage.close();
	}

	// Delete
	GeoPackageManager manager = GeoPackageFactory.getManager(activity);
	manager.delete(TestConstants.TEST_DB_NAME);
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:18,代码来源:TestSetupTeardown.java


示例20: tearDownImport

import mil.nga.geopackage.GeoPackage; //导入依赖的package包/类
/**
 * Tear down the import database
 * 
 * @param activity
 * @param geoPackage
 */
public static void tearDownImport(Activity activity, GeoPackage geoPackage) {

	// Close
	if (geoPackage != null) {
		geoPackage.close();
	}

	// Delete
	GeoPackageManager manager = GeoPackageFactory.getManager(activity);
	manager.delete(TestConstants.IMPORT_DB_NAME);
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:18,代码来源:TestSetupTeardown.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AssignerWithPeriodicWatermarks类代码示例发布时间:2022-05-22
下一篇:
Java RemoteJWKSet类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap