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


Java Projection.getTransformation方法代码示例

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


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

示例1: GoogleMapShapeConverter

import mil.nga.geopackage.projection.Projection; //导入方法依赖的package包/类
/**
 * Constructor with specified projection, see
 * {@link FeatureDao#getProjection}
 *
 * @param projection
 */
public GoogleMapShapeConverter(Projection projection) {
    this.projection = projection;
    if (projection != null) {
        toWgs84 = projection
                .getTransformation(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
        Projection wgs84 = toWgs84.getToProjection();
        fromWgs84 = wgs84.getTransformation(projection);
        toWebMercator = projection.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
        Projection webMercator = toWebMercator.getToProjection();
        fromWebMercator = webMercator.getTransformation(projection);
    } else {
        toWgs84 = null;
        fromWgs84 = null;
        toWebMercator = null;
        fromWebMercator = null;
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:24,代码来源:GoogleMapShapeConverter.java

示例2: getBoundingBox

import mil.nga.geopackage.projection.Projection; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public BoundingBox getBoundingBox() {
    Contents contents = geometryColumns.getContents();

    BoundingBox boundingBox = contents.getBoundingBox();
    if (boundingBox != null) {
        Projection contentsProjection = ProjectionFactory
                .getProjection(contents.getSrs());
        if (!projection.equals(contentsProjection)) {
            ProjectionTransform transform = contentsProjection
                    .getTransformation(projection);
            boundingBox = transform.transform(boundingBox);
        }
    }

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

示例3: getZoomLevel

import mil.nga.geopackage.projection.Projection; //导入方法依赖的package包/类
/**
 * Get the approximate zoom level of where the bounding box of the user data
 * fits into the world
 * 
 * @return zoom level
 * @since 1.1.0
 */
public int getZoomLevel() {
	Projection projection = getProjection();
	if (projection == null) {
		throw new GeoPackageException(
				"No projection was set which is required to determine the zoom level");
	}
	int zoomLevel = 0;
	BoundingBox boundingBox = getBoundingBox();
	if (boundingBox != null) {
		if (projection.getUnit() instanceof DegreeUnit) {
			boundingBox = TileBoundingBoxUtils
					.boundDegreesBoundingBoxWithWebMercatorLimits(boundingBox);
		}
		ProjectionTransform webMercatorTransform = projection
				.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
		BoundingBox webMercatorBoundingBox = webMercatorTransform
				.transform(boundingBox);
		zoomLevel = TileBoundingBoxUtils
				.getZoomLevel(webMercatorBoundingBox);
	}
	return zoomLevel;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:30,代码来源:UserCoreDao.java

示例4: getBoundingBox

import mil.nga.geopackage.projection.Projection; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public BoundingBox getBoundingBox() {
	Contents contents = geometryColumns.getContents();
	Projection contentsProjection = ProjectionFactory
			.getProjection(contents.getSrs());

	BoundingBox boundingBox = contents.getBoundingBox();
	if (!projection.equals(contentsProjection)) {
		ProjectionTransform transform = contentsProjection
				.getTransformation(projection);
		boundingBox = transform.transform(boundingBox);
	}

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

示例5: OsmMapShapeConverter

import mil.nga.geopackage.projection.Projection; //导入方法依赖的package包/类
/**
 * Constructor with specified projection, see
      *
 * @param projection
 */
public OsmMapShapeConverter(Projection projection, MarkerOptions options, PolylineOptions polylineOptions,
                            PolygonOptions polygonOptions) {
    Log.i(IMapView.LOGTAG, "Geopackage support is BETA. Please report any issues");
    this.projection = projection;
    this.polylineOptions=polylineOptions;
    this.polygonOptions=polygonOptions;
    this.makerOptions=options;
    if (projection != null) {
        toWgs84 = projection
            .getTransformation(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
        Projection wgs84 = toWgs84.getToProjection();
        fromWgs84 = wgs84.getTransformation(projection);
    } else {
        toWgs84 = null;
        fromWgs84 = null;
    }
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:23,代码来源:OsmMapShapeConverter.java

示例6: projectGeometry

import mil.nga.geopackage.projection.Projection; //导入方法依赖的package包/类
/**
 * Project the geometry into the provided projection
 *
 * @param geometryData geometry data
 * @param projection   projection
 */
public void projectGeometry(GeoPackageGeometryData geometryData, Projection projection) {

    if (geometryData.getGeometry() != null) {

        try {
            SpatialReferenceSystemDao srsDao = DaoManager.createDao(featureDao.getDb().getConnectionSource(), SpatialReferenceSystem.class);
            int srsId = geometryData.getSrsId();
            SpatialReferenceSystem srs = srsDao.queryForId((long) srsId);

            if (!projection.equals(srs.getOrganization(), srs.getOrganizationCoordsysId())) {

                Projection geomProjection = ProjectionFactory.getProjection(srs);
                ProjectionTransform transform = geomProjection.getTransformation(projection);

                Geometry projectedGeometry = transform.transform(geometryData.getGeometry());
                geometryData.setGeometry(projectedGeometry);
                SpatialReferenceSystem projectionSrs = srsDao.getOrCreateCode(projection.getAuthority(), Long.parseLong(projection.getCode()));
                geometryData.setSrsId((int) projectionSrs.getSrsId());
            }
        } catch (SQLException e) {
            throw new GeoPackageException("Failed to project geometry to projection with Authority: "
                    + projection.getAuthority() + ", Code: " + projection.getCode(), e);
        }
    }

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

示例7: setBoundingBox

import mil.nga.geopackage.projection.Projection; //导入方法依赖的package包/类
/**
 * Set the bounding box, provided as the indicated projection
 *
 * @param boundingBox
 * @param projection
 */
public void setBoundingBox(BoundingBox boundingBox, Projection projection) {
    ProjectionTransform projectionToWebMercator = projection
            .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
    webMercatorBoundingBox = projectionToWebMercator
            .transform(boundingBox);
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:13,代码来源:BoundedOverlay.java

示例8: getFeatureBoundingBox

import mil.nga.geopackage.projection.Projection; //导入方法依赖的package包/类
/**
 * Get the bounding box in the feature projection from the bounding box in
 * the provided projection
 *
 * @param boundingBox bounding box
 * @param projection  projection
 * @return feature projected bounding box
 */
private BoundingBox getFeatureBoundingBox(BoundingBox boundingBox,
                                          Projection projection) {
    ProjectionTransform projectionTransform = projection
            .getTransformation(featureDao.getProjection());
    BoundingBox featureBoundingBox = projectionTransform
            .transform(boundingBox);
    return featureBoundingBox;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:17,代码来源:FeatureTableIndex.java

示例9: getFeatureBoundingBox

import mil.nga.geopackage.projection.Projection; //导入方法依赖的package包/类
/**
 * Get the bounding box in the feature projection from the bounding box in
 * the provided projection
 *
 * @param boundingBox
 * @param projection
 * @return feature projected bounding box
 */
private BoundingBox getFeatureBoundingBox(BoundingBox boundingBox,
                                          Projection projection) {
    ProjectionTransform projectionTransform = projection
            .getTransformation(featureDao.getProjection());
    BoundingBox featureBoundingBox = projectionTransform
            .transform(boundingBox);
    return featureBoundingBox;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:17,代码来源:FeatureIndexer.java

示例10: testRandomLocations

import mil.nga.geopackage.projection.Projection; //导入方法依赖的package包/类
/**
 * Test 10 random locations and optionally print
 *
 * @throws Exception
 */
public void testRandomLocations() throws Exception {

    BoundingBox projectedBoundingBox = null;

    List<String> elevationTables = ElevationTilesTiff.getTables(geoPackage);
    TileMatrixSetDao dao = geoPackage.getTileMatrixSetDao();

    for (String elevationTable : elevationTables) {

        TileMatrixSet tileMatrixSet = dao.queryForId(elevationTable);

        BoundingBox boundingBox = tileMatrixSet.getBoundingBox();
        if (PRINT) {
            System.out.println("Min Latitude: "
                    + boundingBox.getMinLatitude());
            System.out.println("Max Latitude: "
                    + boundingBox.getMaxLatitude());
            System.out.println("Min Longitude: "
                    + boundingBox.getMinLongitude());
            System.out.println("Max Longitude: "
                    + boundingBox.getMaxLongitude());
            System.out.println();
        }
        SpatialReferenceSystemDao srsDao = geoPackage
                .getSpatialReferenceSystemDao();
        long srsId = tileMatrixSet.getSrsId();
        SpatialReferenceSystem srs = srsDao.queryForId(srsId);
        Projection projection = ProjectionFactory.getProjection(srs);
        Projection requestProjection = ProjectionFactory
                .getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
        ProjectionTransform elevationToRequest = projection
                .getTransformation(requestProjection);
        projectedBoundingBox = elevationToRequest.transform(boundingBox);

    }
    if (PRINT) {
        System.out.println("Min Latitude: "
                + projectedBoundingBox.getMinLatitude());
        System.out.println("Max Latitude: "
                + projectedBoundingBox.getMaxLatitude());
        System.out.println("Min Longitude: "
                + projectedBoundingBox.getMinLongitude());
        System.out.println("Max Longitude: "
                + projectedBoundingBox.getMaxLongitude());
        System.out.println();
    }

    double latDistance = projectedBoundingBox.getMaxLatitude()
            - projectedBoundingBox.getMinLatitude();
    double lonDistance = projectedBoundingBox.getMaxLongitude()
            - projectedBoundingBox.getMinLongitude();

    for (int i = 0; i < 10; i++) {

        // Get a random coordinate
        double latitude = latDistance * .9 * Math.random()
                + projectedBoundingBox.getMinLatitude()
                + (.05 * latDistance);
        double longitude = lonDistance * .9 * Math.random()
                + projectedBoundingBox.getMinLongitude()
                + (.05 * lonDistance);
        testLocation(latitude, longitude);
        if (PRINT) {
            System.out.println();
        }
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:73,代码来源:ElevationTilesTiffImportTest.java

示例11: testRandomLocations

import mil.nga.geopackage.projection.Projection; //导入方法依赖的package包/类
/**
 * Test 10 random locations and optionally print
 *
 * @throws Exception
 */
public void testRandomLocations() throws Exception {

    BoundingBox projectedBoundingBox = null;

    List<String> elevationTables = ElevationTilesPng.getTables(geoPackage);
    TileMatrixSetDao dao = geoPackage.getTileMatrixSetDao();

    for (String elevationTable : elevationTables) {

        TileMatrixSet tileMatrixSet = dao.queryForId(elevationTable);

        BoundingBox boundingBox = tileMatrixSet.getBoundingBox();
        if (PRINT) {
            System.out.println("Min Latitude: "
                    + boundingBox.getMinLatitude());
            System.out.println("Max Latitude: "
                    + boundingBox.getMaxLatitude());
            System.out.println("Min Longitude: "
                    + boundingBox.getMinLongitude());
            System.out.println("Max Longitude: "
                    + boundingBox.getMaxLongitude());
            System.out.println();
        }
        SpatialReferenceSystemDao srsDao = geoPackage
                .getSpatialReferenceSystemDao();
        long srsId = tileMatrixSet.getSrsId();
        SpatialReferenceSystem srs = srsDao.queryForId(srsId);
        Projection projection = ProjectionFactory.getProjection(srs);
        Projection requestProjection = ProjectionFactory
                .getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
        ProjectionTransform elevationToRequest = projection
                .getTransformation(requestProjection);
        projectedBoundingBox = elevationToRequest.transform(boundingBox);

    }
    if (PRINT) {
        System.out.println("Min Latitude: "
                + projectedBoundingBox.getMinLatitude());
        System.out.println("Max Latitude: "
                + projectedBoundingBox.getMaxLatitude());
        System.out.println("Min Longitude: "
                + projectedBoundingBox.getMinLongitude());
        System.out.println("Max Longitude: "
                + projectedBoundingBox.getMaxLongitude());
        System.out.println();
    }

    double latDistance = projectedBoundingBox.getMaxLatitude()
            - projectedBoundingBox.getMinLatitude();
    double lonDistance = projectedBoundingBox.getMaxLongitude()
            - projectedBoundingBox.getMinLongitude();

    for (int i = 0; i < 10; i++) {

        // Get a random coordinate
        double latitude = latDistance * .9 * Math.random()
                + projectedBoundingBox.getMinLatitude()
                + (.05 * latDistance);
        double longitude = lonDistance * .9 * Math.random()
                + projectedBoundingBox.getMinLongitude()
                + (.05 * lonDistance);
        testLocation(latitude, longitude);
        if (PRINT) {
            System.out.println();
        }
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:73,代码来源:ElevationTilesPngImportTest.java

示例12: testGeometryProjectionTransform

import mil.nga.geopackage.projection.Projection; //导入方法依赖的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

示例13: testRandomLocations

import mil.nga.geopackage.projection.Projection; //导入方法依赖的package包/类
/**
 * Test 10 random locations and optionally print
 * 
 * @throws Exception
 */
@Test
public void testRandomLocations() throws Exception {

	BoundingBox projectedBoundingBox = null;

	List<String> elevationTables = ElevationTilesTiff.getTables(geoPackage);
	TileMatrixSetDao dao = geoPackage.getTileMatrixSetDao();

	for (String elevationTable : elevationTables) {

		TileMatrixSet tileMatrixSet = dao.queryForId(elevationTable);

		BoundingBox boundingBox = tileMatrixSet.getBoundingBox();
		if (PRINT) {
			System.out.println("Min Latitude: "
					+ boundingBox.getMinLatitude());
			System.out.println("Max Latitude: "
					+ boundingBox.getMaxLatitude());
			System.out.println("Min Longitude: "
					+ boundingBox.getMinLongitude());
			System.out.println("Max Longitude: "
					+ boundingBox.getMaxLongitude());
			System.out.println();
		}
		SpatialReferenceSystemDao srsDao = geoPackage
				.getSpatialReferenceSystemDao();
		long srsId = tileMatrixSet.getSrsId();
		SpatialReferenceSystem srs = srsDao.queryForId(srsId);
		Projection projection = ProjectionFactory.getProjection(srs);
		Projection requestProjection = ProjectionFactory
				.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
		ProjectionTransform elevationToRequest = projection
				.getTransformation(requestProjection);
		projectedBoundingBox = elevationToRequest.transform(boundingBox);

	}
	if (PRINT) {
		System.out.println("Min Latitude: "
				+ projectedBoundingBox.getMinLatitude());
		System.out.println("Max Latitude: "
				+ projectedBoundingBox.getMaxLatitude());
		System.out.println("Min Longitude: "
				+ projectedBoundingBox.getMinLongitude());
		System.out.println("Max Longitude: "
				+ projectedBoundingBox.getMaxLongitude());
		System.out.println();
	}

	double latDistance = projectedBoundingBox.getMaxLatitude()
			- projectedBoundingBox.getMinLatitude();
	double lonDistance = projectedBoundingBox.getMaxLongitude()
			- projectedBoundingBox.getMinLongitude();

	for (int i = 0; i < 10; i++) {

		// Get a random coordinate
		double latitude = latDistance * .9 * Math.random()
				+ projectedBoundingBox.getMinLatitude()
				+ (.05 * latDistance);
		double longitude = lonDistance * .9 * Math.random()
				+ projectedBoundingBox.getMinLongitude()
				+ (.05 * lonDistance);
		testLocation(latitude, longitude);
		if (PRINT) {
			System.out.println();
		}
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:74,代码来源:ElevationTilesTiffImportTest.java

示例14: testRandomLocations

import mil.nga.geopackage.projection.Projection; //导入方法依赖的package包/类
/**
 * Test 10 random locations and optionally print
 * 
 * @throws Exception
 */
@Test
public void testRandomLocations() throws Exception {

	BoundingBox projectedBoundingBox = null;

	List<String> elevationTables = ElevationTilesPng.getTables(geoPackage);
	TileMatrixSetDao dao = geoPackage.getTileMatrixSetDao();

	for (String elevationTable : elevationTables) {

		TileMatrixSet tileMatrixSet = dao.queryForId(elevationTable);

		BoundingBox boundingBox = tileMatrixSet.getBoundingBox();
		if (PRINT) {
			System.out.println("Min Latitude: "
					+ boundingBox.getMinLatitude());
			System.out.println("Max Latitude: "
					+ boundingBox.getMaxLatitude());
			System.out.println("Min Longitude: "
					+ boundingBox.getMinLongitude());
			System.out.println("Max Longitude: "
					+ boundingBox.getMaxLongitude());
			System.out.println();
		}
		SpatialReferenceSystemDao srsDao = geoPackage
				.getSpatialReferenceSystemDao();
		long srsId = tileMatrixSet.getSrsId();
		SpatialReferenceSystem srs = srsDao.queryForId(srsId);
		Projection projection = ProjectionFactory.getProjection(srs);
		Projection requestProjection = ProjectionFactory
				.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
		ProjectionTransform elevationToRequest = projection
				.getTransformation(requestProjection);
		projectedBoundingBox = elevationToRequest.transform(boundingBox);

	}
	if (PRINT) {
		System.out.println("Min Latitude: "
				+ projectedBoundingBox.getMinLatitude());
		System.out.println("Max Latitude: "
				+ projectedBoundingBox.getMaxLatitude());
		System.out.println("Min Longitude: "
				+ projectedBoundingBox.getMinLongitude());
		System.out.println("Max Longitude: "
				+ projectedBoundingBox.getMaxLongitude());
		System.out.println();
	}

	double latDistance = projectedBoundingBox.getMaxLatitude()
			- projectedBoundingBox.getMinLatitude();
	double lonDistance = projectedBoundingBox.getMaxLongitude()
			- projectedBoundingBox.getMinLongitude();

	for (int i = 0; i < 10; i++) {

		// Get a random coordinate
		double latitude = latDistance * .9 * Math.random()
				+ projectedBoundingBox.getMinLatitude()
				+ (.05 * latDistance);
		double longitude = lonDistance * .9 * Math.random()
				+ projectedBoundingBox.getMinLongitude()
				+ (.05 * lonDistance);
		testLocation(latitude, longitude);
		if (PRINT) {
			System.out.println();
		}
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:74,代码来源:ElevationTilesPngImportTest.java

示例15: testGeometryProjectionTransform

import mil.nga.geopackage.projection.Projection; //导入方法依赖的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.projection.Projection.getTransformation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。