本文整理汇总了Java中org.opengis.referencing.operation.Conversion类的典型用法代码示例。如果您正苦于以下问题:Java Conversion类的具体用法?Java Conversion怎么用?Java Conversion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Conversion类属于org.opengis.referencing.operation包,在下文中一共展示了Conversion类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCRS
import org.opengis.referencing.operation.Conversion; //导入依赖的package包/类
@Override
public CoordinateReferenceSystem getCRS(final GeoPos referencePos, ParameterValueGroup parameters,
GeodeticDatum datum) throws FactoryException {
final CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
// in some cases, depending on the parameters set, the effective transformation can be different
// from the transformation given by the OperationMethod.
// So we create a new one
final MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);
final MathTransform transform = mtFactory.createParameterizedTransform(parameters);
final DefaultOperationMethod operationMethod = new DefaultOperationMethod(transform);
final Conversion conversion = new DefiningConversion(AbstractIdentifiedObject.getProperties(operationMethod),
operationMethod, transform);
final HashMap<String, Object> baseCrsProperties = new HashMap<String, Object>();
baseCrsProperties.put("name", datum.getName().getCode());
GeographicCRS baseCrs = crsFactory.createGeographicCRS(baseCrsProperties,
datum,
DefaultEllipsoidalCS.GEODETIC_2D);
final HashMap<String, Object> projProperties = new HashMap<String, Object>();
projProperties.put("name", conversion.getName().getCode() + " / " + datum.getName().getCode());
return crsFactory.createProjectedCRS(projProperties, baseCrs, conversion, DefaultCartesianCS.PROJECTED);
}
示例2: createCrs
import org.opengis.referencing.operation.Conversion; //导入依赖的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);
}
示例3: createCRSByHand1
import org.opengis.referencing.operation.Conversion; //导入依赖的package包/类
/**
* Creates a WGS 84/UTM Zone 10N CRS mostly (uses some premade objects) by hand. Uses the higher
* level FactoryGroup instead of the lower level MathTransformFactory (commented out).
*
* @throws Exception
*/
void createCRSByHand1() throws Exception {
System.out.println("------------------------------------------");
System.out.println("Creating a CRS by hand:");
// createCRSByHand1 start
MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);
CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
GeographicCRS geoCRS = org.geotools.referencing.crs.DefaultGeographicCRS.WGS84;
CartesianCS cartCS = org.geotools.referencing.cs.DefaultCartesianCS.GENERIC_2D;
ParameterValueGroup parameters = mtFactory.getDefaultParameters("Transverse_Mercator");
parameters.parameter("central_meridian").setValue(-111.0);
parameters.parameter("latitude_of_origin").setValue(0.0);
parameters.parameter("scale_factor").setValue(0.9996);
parameters.parameter("false_easting").setValue(500000.0);
parameters.parameter("false_northing").setValue(0.0);
Conversion conversion = new DefiningConversion("Transverse_Mercator", parameters);
Map<String, ?> properties = Collections.singletonMap("name", "WGS 84 / UTM Zone 12N");
ProjectedCRS projCRS = crsFactory.createProjectedCRS(properties, geoCRS, conversion, cartCS);
// createCRSByHand1 end
// parameters.parameter("semi_major").setValue(((GeodeticDatum)geoCRS.getDatum()).getEllipsoid().getSemiMajorAxis());
// parameters.parameter("semi_minor").setValue(((GeodeticDatum)geoCRS.getDatum()).getEllipsoid().getSemiMinorAxis());
// MathTransform trans = mtFactory.createParameterizedTransform(parameters);
// ProjectedCRS projCRS = crsFactory.createProjectedCRS(
// Collections.singletonMap("name", "WGS 84 / UTM Zone 12N"),
// new org.geotools.referencing.operation.OperationMethod(trans),
// geoCRS, trans, cartCS);
System.out.println(" Projected CRS: " + projCRS.toWKT());
System.out.println("------------------------------------------");
// save for later use in createMathTransformBetweenCRSs()
this.utm10NCRS = projCRS;
}
示例4: getConversionFromBase
import org.opengis.referencing.operation.Conversion; //导入依赖的package包/类
public Conversion getConversionFromBase() {
return base.getConversionFromBase();
}