本文整理汇总了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);
}
示例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;
}