org.geotools.referencing.CRS.getVerticalCRS()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.geotools.referencing.CRS.getVerticalCRS()方法的一些代码示例,展示了CRS.getVerticalCRS()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CRS.getVerticalCRS()方法的具体详情如下:
包路径:org.geotools.referencing.CRS
类名称:CRS
方法名:getVerticalCRS

CRS.getVerticalCRS介绍

[英]Returns the first vertical coordinate reference system found in a the given CRS, or null if there is none.
[中]返回在给定CRS中找到的第一个垂直坐标系,如果没有,则返回null。

代码示例

代码示例来源:origin: geotools/geotools

/**
 * Returns the first vertical 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 vertical CRS, or {@code null} if none.
 * @since 2.4
 */
public static VerticalCRS getVerticalCRS(final CoordinateReferenceSystem crs) {
  if (crs instanceof VerticalCRS) {
    return (VerticalCRS) crs;
  }
  if (crs instanceof CompoundCRS) {
    final CompoundCRS cp = (CompoundCRS) crs;
    for (final CoordinateReferenceSystem c : cp.getCoordinateReferenceSystems()) {
      final VerticalCRS candidate = getVerticalCRS(c);
      if (candidate != null) {
        return candidate;
      }
    }
  }
  return null;
}

代码示例来源:origin: georocket/georocket

/**
  * A simple test
  * @throws Exception if the test fails
  */
 @Test
 public void compoundCrs() throws Exception {
  CoordinateReferenceSystem c = CompoundCRSDecoder.decode("urn:ogc:def:crs,crs:EPSG:6.12:3068,crs:EPSG:6.12:5783");
  assertEquals(CRS.decode("EPSG:3068"), CRS.getHorizontalCRS(c));
  assertEquals(CRS.decode("EPSG:5783"), CRS.getVerticalCRS(c));
 }
}

相关文章