本文整理了Java中org.geotools.referencing.CRS.getProjectedCRS()
方法的一些代码示例,展示了CRS.getProjectedCRS()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CRS.getProjectedCRS()
方法的具体详情如下:
包路径:org.geotools.referencing.CRS
类名称:CRS
方法名:getProjectedCRS
[英]Returns the first projected coordinate reference system found in a the given CRS, or null if there is none.
[中]返回在给定CRS中找到的第一个投影坐标系,如果没有,则返回null。
代码示例来源:origin: geotools/geotools
/**
* Returns the first projected coordinate reference system found in a the given CRS, or {@code
* null} if there is none.
*
* @param crs The coordinate reference system, or {@code null}.
* @return The projected CRS, or {@code null} if none.
* @since 2.4
*/
public static ProjectedCRS getProjectedCRS(final CoordinateReferenceSystem crs) {
if (crs instanceof ProjectedCRS) {
return (ProjectedCRS) crs;
}
if (crs instanceof CompoundCRS) {
final CompoundCRS cp = (CompoundCRS) crs;
for (final CoordinateReferenceSystem c : cp.getCoordinateReferenceSystems()) {
final ProjectedCRS candidate = getProjectedCRS(c);
if (candidate != null) {
return candidate;
}
}
}
return null;
}
代码示例来源:origin: geotools/geotools
/**
* Returns the {@link MapProjection} driving the specified crs, or {@code null} if none could be
* found.
*
* @param crs The coordinate reference system, or {@code null}.
* @return The {@link MapProjection}, or {@code null} if none.
*/
public static MapProjection getMapProjection(final CoordinateReferenceSystem crs) {
ProjectedCRS projectedCRS = CRS.getProjectedCRS(crs);
if (projectedCRS == null) return null;
Projection conversion = projectedCRS.getConversionFromBase();
MathTransform mt = conversion.getMathTransform();
return unrollProjection(mt);
}
代码示例来源:origin: geotools/geotools
private static boolean isPole(DirectPosition point, CoordinateReferenceSystem crs) {
DirectPosition result = new DirectPosition2D();
GeographicCRS geographic;
try {
ProjectedCRS projectedCRS = getProjectedCRS(crs);
if (projectedCRS != null) {
geographic = projectedCRS.getBaseCRS();
MathTransform mt = CRS.findMathTransform(projectedCRS, geographic);
mt.transform(point, result);
} else if (crs instanceof GeographicCRS) {
result = point;
geographic = (GeographicCRS) crs;
} else {
return false;
}
} catch (MismatchedDimensionException | TransformException | FactoryException e) {
return false;
}
final double EPS = 1e-6;
if (getAxisOrder(geographic) == AxisOrder.NORTH_EAST) {
return Math.abs(result.getOrdinate(0) - 90) < EPS
|| Math.abs(result.getOrdinate(0) + 90) < EPS;
} else {
return Math.abs(result.getOrdinate(1) - 90) < EPS
|| Math.abs(result.getOrdinate(1) + 90) < EPS;
}
}
代码示例来源:origin: geotools/geotools
if (CRS.getProjectedCRS(geometryCRS) != null) {
precision = 1e-3;
} else {
代码示例来源:origin: geotools/geotools
@BeforeClass
public static void setupClass() throws FactoryException, TransformException {
sphericalGeosCRS = CRS.parseWKT(sphericalGeosWKT);
sphericalGeosToGeog =
CRS.findMathTransform(
sphericalGeosCRS, CRS.getProjectedCRS(sphericalGeosCRS).getBaseCRS(), true);
geogToSphericalGeos = sphericalGeosToGeog.inverse();
ellipsoidalGeosCRS = CRS.parseWKT(ellipsoidalGeosWKT);
ellipsoidalGeosToGeog =
CRS.findMathTransform(
ellipsoidalGeosCRS,
CRS.getProjectedCRS(ellipsoidalGeosCRS).getBaseCRS(),
true);
geogToEllipsoidalGeos = ellipsoidalGeosToGeog.inverse();
}
代码示例来源:origin: geotools/geotools
/** Circumscribed rectangle (smallest) for full disk earth image */
public static Envelope2D circumscribeFullDisk(CoordinateReferenceSystem geosCRS)
throws TransformException, FactoryException {
if (!isGeostationaryCRS(geosCRS)) {
return null;
}
MathTransform mt =
CRS.findMathTransform(geosCRS, CRS.getProjectedCRS(geosCRS).getBaseCRS(), true);
MathTransform imt = mt.inverse();
ParameterValueGroup parameters = CRS.getMapProjection(geosCRS).getParameterValues();
double semiMajorAxis = parameters.parameter("semi_major").doubleValue();
double satelliteHeight = parameters.parameter("satellite_height").doubleValue();
double centralMeridian = parameters.parameter("central_meridian").doubleValue();
DirectPosition2D dp2d = new DirectPosition2D();
double halfFoVRadians = Math.acos(semiMajorAxis / (satelliteHeight + semiMajorAxis));
double halfFoVDegrees = Math.toDegrees(halfFoVRadians);
dp2d.setLocation(centralMeridian - halfFoVDegrees, 0.);
imt.transform(dp2d, dp2d);
double xMin = dp2d.getX();
dp2d.setLocation(centralMeridian + halfFoVDegrees, 0.);
imt.transform(dp2d, dp2d);
double xMax = dp2d.getX();
dp2d.setLocation(centralMeridian, -halfFoVDegrees);
imt.transform(dp2d, dp2d);
double yMin = dp2d.getY();
dp2d.setLocation(centralMeridian, halfFoVDegrees);
imt.transform(dp2d, dp2d);
double yMax = dp2d.getY();
return new Envelope2D(geosCRS, xMin, yMin, xMax - xMin, yMax - yMin);
}
代码示例来源:origin: org.geotools/gt2-coverageio
public Object getValue(final GridCoverage coverage) {
final ProjectedCRS crs;
crs = CRS.getProjectedCRS(coverage.getCoordinateReferenceSystem());
return (crs!=null) ? crs.getConversionFromBase() : null;
}
};
代码示例来源:origin: org.geotools/gt2-coverageio
/**
* Returns the value for this key from the specified grid coverage.
*/
public Object getValue(final GridCoverage coverage) {
final ProjectedCRS crs = CRS.getProjectedCRS(coverage.getCoordinateReferenceSystem());
if (crs != null) {
final ParameterValueGroup parameters = crs.getConversionFromBase().getParameterValues();
try {
return parameters.parameter(toString()).getValue();
} catch (ParameterNotFoundException exception) {
// No value set for the specified parameter.
// This is not an error. Just ignore...
}
}
return null;
}
}
内容来源于网络,如有侵权,请联系作者删除!