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


Java GeoPackage.getSpatialReferenceSystemDao方法代码示例

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


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

示例1: testGeometryProjectionTransform

import mil.nga.geopackage.GeoPackage; //导入方法依赖的package包/类
/**
 * Test transforming geometries between projections
 *
 * @param geoPackage
 * @throws SQLException
 * @throws IOException
 */
public static void testGeometryProjectionTransform(GeoPackage geoPackage)
		throws SQLException, IOException {

	GeometryColumnsDao geometryColumnsDao = geoPackage
			.getGeometryColumnsDao();

	if (geometryColumnsDao.isTableExists()) {
		List<GeometryColumns> results = geometryColumnsDao.queryForAll();

		for (GeometryColumns geometryColumns : results) {

			FeatureDao dao = geoPackage.getFeatureDao(geometryColumns);
			TestCase.assertNotNull(dao);

			FeatureCursor cursor = dao.queryForAll();

			while (cursor.moveToNext()) {

				GeoPackageGeometryData geometryData = cursor.getGeometry();
				if (geometryData != null) {

					Geometry geometry = geometryData.getGeometry();

					if (geometry != null) {

						SpatialReferenceSystemDao srsDao = geoPackage
								.getSpatialReferenceSystemDao();
						long srsId = geometryData.getSrsId();
						SpatialReferenceSystem srs = srsDao
								.queryForId(srsId);

						long epsg = srs.getOrganizationCoordsysId();
						Projection projection = ProjectionFactory
								.getProjection(srs);
						long toEpsg = -1;
						if (epsg == ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM) {
							toEpsg = ProjectionConstants.EPSG_WEB_MERCATOR;
						} else {
							toEpsg = ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM;
						}
						ProjectionTransform transformTo = projection
								.getTransformation(toEpsg);
						ProjectionTransform transformFrom = transformTo
								.getToProjection().getTransformation(srs);

						byte[] bytes = geometryData.getWkbBytes();

						Geometry projectedGeometry = transformTo
								.transform(geometry);
						GeoPackageGeometryData projectedGeometryData = new GeoPackageGeometryData(
								-1);
						projectedGeometryData
								.setGeometry(projectedGeometry);
						projectedGeometryData.toBytes();
						byte[] projectedBytes = projectedGeometryData
								.getWkbBytes();

						if (epsg > 0) {
							TestCase.assertFalse(equalByteArrays(bytes,
									projectedBytes));
						}

						Geometry restoredGeometry = transformFrom
								.transform(projectedGeometry);

						compareGeometries(geometry, restoredGeometry, .001);
					}
				}

			}
			cursor.close();
		}
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:82,代码来源:GeoPackageGeometryDataUtils.java

示例2: viewDatabaseOption

import mil.nga.geopackage.GeoPackage; //导入方法依赖的package包/类
/**
 * View database information
 *
 * @param database
 */
private void viewDatabaseOption(final String database) {
    StringBuilder databaseInfo = new StringBuilder();
    GeoPackage geoPackage = manager.open(database);
    try {
        SpatialReferenceSystemDao srsDao = geoPackage
                .getSpatialReferenceSystemDao();

        List<SpatialReferenceSystem> srsList = srsDao.queryForAll();
        databaseInfo.append("Size: ")
                .append(manager.readableSize(database));
        databaseInfo.append("\n\nLocation: ").append(
                manager.isExternal(database) ? "External" : "Local");
        databaseInfo.append("\nPath: ").append(manager.getPath(database));
        databaseInfo.append("\n\nFeature Tables: ").append(
                geoPackage.getFeatureTables().size());
        databaseInfo.append("\nTile Tables: ").append(
                geoPackage.getTileTables().size());
        databaseInfo.append("\n\nSpatial Reference Systems: ").append(
                srsList.size());
        for (SpatialReferenceSystem srs : srsList) {
            databaseInfo.append("\n");
            addSrs(databaseInfo, srs);
        }

    } catch (Exception e) {
        databaseInfo.append(e.getMessage());
    } finally {
        geoPackage.close();
    }
    AlertDialog viewDialog = new AlertDialog.Builder(getActivity(), R.style.AppCompatAlertDialogStyle)
            .setTitle(database)
            .setPositiveButton(getString(R.string.button_ok_label),

                    new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.dismiss();
                        }
                    }).setMessage(databaseInfo.toString()).create();
    viewDialog.show();
}
 
开发者ID:ngageoint,项目名称:geopackage-mapcache-android,代码行数:47,代码来源:GeoPackageManagerFragment.java

示例3: testGeometryProjectionTransform

import mil.nga.geopackage.GeoPackage; //导入方法依赖的package包/类
/**
 * Test transforming geometries between projections
 * 
 * @param geoPackage
 * @throws SQLException
 * @throws IOException
 */
public static void testGeometryProjectionTransform(GeoPackage geoPackage)
		throws SQLException, IOException {

	GeometryColumnsDao geometryColumnsDao = geoPackage
			.getGeometryColumnsDao();

	if (geometryColumnsDao.isTableExists()) {
		List<GeometryColumns> results = geometryColumnsDao.queryForAll();

		for (GeometryColumns geometryColumns : results) {

			FeatureDao dao = geoPackage.getFeatureDao(geometryColumns);
			TestCase.assertNotNull(dao);

			FeatureResultSet cursor = dao.queryForAll();

			while (cursor.moveToNext()) {

				GeoPackageGeometryData geometryData = cursor.getGeometry();
				if (geometryData != null) {

					Geometry geometry = geometryData.getGeometry();

					if (geometry != null) {

						SpatialReferenceSystemDao srsDao = geoPackage
								.getSpatialReferenceSystemDao();
						long srsId = geometryData.getSrsId();
						SpatialReferenceSystem srs = srsDao
								.queryForId(srsId);

						long epsg = srs.getOrganizationCoordsysId();
						Projection projection = ProjectionFactory
								.getProjection(srs);
						long toEpsg = -1;
						if (epsg == ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM) {
							toEpsg = ProjectionConstants.EPSG_WEB_MERCATOR;
						} else {
							toEpsg = ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM;
						}
						ProjectionTransform transformTo = projection
								.getTransformation(toEpsg);
						ProjectionTransform transformFrom = transformTo
								.getToProjection().getTransformation(srs);

						byte[] bytes = geometryData.getWkbBytes();

						Geometry projectedGeometry = transformTo
								.transform(geometry);
						GeoPackageGeometryData projectedGeometryData = new GeoPackageGeometryData(
								-1);
						projectedGeometryData
								.setGeometry(projectedGeometry);
						projectedGeometryData.toBytes();
						byte[] projectedBytes = projectedGeometryData
								.getWkbBytes();

						if (epsg > 0) {
							TestCase.assertFalse(equalByteArrays(bytes,
									projectedBytes));
						}

						Geometry restoredGeometry = transformFrom
								.transform(projectedGeometry);

						compareGeometries(geometry, restoredGeometry, .001);
					}
				}

			}
			cursor.close();
		}
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:82,代码来源:GeoPackageGeometryDataUtils.java


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