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


Java CoordinateOperationFactory类代码示例

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


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

示例1: createCrs

import org.opengis.referencing.operation.CoordinateOperationFactory; //导入依赖的package包/类
CoordinateReferenceSystem createCrs(String crsName, OperationMethod method,
                                              ParameterValueGroup parameters,
                                              GeodeticDatum datum) throws FactoryException {
    final CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
    final CoordinateOperationFactory coFactory = ReferencingFactoryFinder.getCoordinateOperationFactory(null);
    final HashMap<String, Object> projProperties = new HashMap<String, Object>();
    projProperties.put("name", crsName + " / " + datum.getName().getCode());
    final Conversion conversion = coFactory.createDefiningConversion(projProperties,
                                                                     method,
                                                                     parameters);
    final HashMap<String, Object> baseCrsProperties = new HashMap<String, Object>();
    baseCrsProperties.put("name", datum.getName().getCode());
    final GeographicCRS baseCrs = crsFactory.createGeographicCRS(baseCrsProperties, datum,
                                                                 DefaultEllipsoidalCS.GEODETIC_2D);
    return crsFactory.createProjectedCRS(projProperties, baseCrs, conversion, DefaultCartesianCS.PROJECTED);
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:17,代码来源:AbstractUTMCrsProvider.java

示例2: convertUTM_MGA942Geographic_EPSG4326

import org.opengis.referencing.operation.CoordinateOperationFactory; //导入依赖的package包/类
public static Geometry convertUTM_MGA942Geographic_EPSG4326(Double easting, Double northing, String zone) throws NoSuchAuthorityCodeException, FactoryException, MismatchedDimensionException, TransformException{
	CoordinateReferenceSystem geographic = CRS.decode("EPSG:4326", false);
	CoordinateReferenceSystem geographic2 = ReferencingFactoryFinder.getCRSAuthorityFactory(
			"EPSG", null).createCoordinateReferenceSystem("4326");
	

	
	CoordinateReferenceSystem utm = ReferencingFactoryFinder.getCRSAuthorityFactory(
			"EPSG", null).createCoordinateReferenceSystem("283"+zone);
	
	CoordinateOperationFactory coFactory = ReferencingFactoryFinder
			.getCoordinateOperationFactory(null);
	
	CoordinateReferenceSystem sourceCRS = utm;		
	CoordinateReferenceSystem targetCRS = geographic;

	GeometryFactory gf = new GeometryFactory();
       Coordinate coord = new Coordinate( easting, northing );
       Point point = gf.createPoint( coord );
       
	
	MathTransform mathTransform =CRS.findMathTransform( sourceCRS, targetCRS,true );
	Geometry g2 = JTS.transform(point, mathTransform);
	
	//VT: Flip around to correct the lat lon from the utm to geographic transformation
	Coordinate[] original = g2.getCoordinates();
	for(int i = 0; i < original.length; i++){
	    Double swapValue = original[i].x;
	    original[i].x = original[i].y;
	    original[i].y = swapValue;
	}
    
	return g2;
}
 
开发者ID:AuScope,项目名称:igsn30,代码行数:35,代码来源:SpatialUtilities.java


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