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


Java GeodeticCalculator.setStartingPosition方法代码示例

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


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

示例1: distanceInCrs

import org.geotools.referencing.GeodeticCalculator; //导入方法依赖的package包/类
private double distanceInCrs(double inMeters,
        double[] refXY,
        CoordinateReferenceSystem crs) throws TransformException {
    double dist = 0;

    // calculate the distance in meters of 0.01 * refY in the ref CRS
    double[] sp = {refXY[0], refXY[1]};
    double[] dp = {refXY[0], refXY[1] * 1.01};

    GeodeticCalculator gc = new GeodeticCalculator(crs);

    gc.setStartingPosition(new DirectPosition2D(crs, sp[0], sp[1]));
    gc.setDestinationPosition(new DirectPosition2D(crs, dp[0], dp[1]));

    double refY01InMeters = gc.getOrthodromicDistance();

    // now, calculate the CRS distance as a proportional of 0.01 * refY
    dist = inMeters * (refXY[1] * 0.01) / refY01InMeters;

    return dist;
}
 
开发者ID:geobeyond,项目名称:fluxomajic,代码行数:22,代码来源:FluxoFilterFunction.java

示例2: getUnitLength

import org.geotools.referencing.GeodeticCalculator; //导入方法依赖的package包/类
private double getUnitLength(String mapCrsKey, Bbox mapBounds) throws LayerException {
	try {
		if (null == mapBounds) {
			throw new LayerException(ExceptionCode.MAP_MAX_EXTENT_MISSING);
		}
		Crs crs = geoService.getCrs2(mapCrsKey);
		GeodeticCalculator calculator = new GeodeticCalculator(crs);
		Coordinate center = new Coordinate(0.5 * (mapBounds.getX() + mapBounds.getMaxX()),
				0.5 * (mapBounds.getY() + mapBounds.getMaxY()));
		calculator.setStartingPosition(new DirectPosition2D(crs, center.getX(), center.getY()));
		calculator.setDestinationPosition(new DirectPosition2D(crs, center.getX() + 1, center.getY()));
		return calculator.getOrthodromicDistance();
	} catch (TransformException e) {
		throw new LayerException(e, ExceptionCode.TRANSFORMER_CREATE_LAYER_TO_MAP_FAILED);
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:17,代码来源:ConfigurationDtoPostProcessor.java


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