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

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

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

CRS.getMapProjection介绍

[英]Returns the MapProjection driving the specified crs, or null if none could be found.
[中]返回驱动指定CR的MapProjection,如果找不到,则返回null。

代码示例

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

public ProjectionHandler getHandler(
      ReferencedEnvelope renderingEnvelope,
      CoordinateReferenceSystem sourceCrs,
      boolean wrap,
      int maxWraps)
      throws FactoryException {
    if (renderingEnvelope == null) {
      return null;
    }
    MapProjection mapProjection =
        CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem());
    if (mapProjection instanceof WorldVanDerGrintenI) {
      ReferencedEnvelope validArea =
          new ReferencedEnvelope(
              -Integer.MAX_VALUE,
              Integer.MAX_VALUE,
              -90,
              90,
              DefaultGeographicCRS.WGS84);

      return new ProjectionHandler(sourceCrs, validArea, renderingEnvelope);
    }

    return null;
  }
}

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

public void testGetMapProjection() throws Exception {
  CoordinateReferenceSystem utm32OnLonLat = CRS.decode("EPSG:23032", true);
  assertTrue(CRS.getMapProjection(utm32OnLonLat) instanceof TransverseMercator);
  CoordinateReferenceSystem utm32OnLatLon = CRS.decode("EPSG:23032", false);
  assertTrue(CRS.getMapProjection(utm32OnLatLon) instanceof TransverseMercator);
  CoordinateReferenceSystem nad27Tennessee = CRS.decode("EPSG:2062", false);
  assertTrue(CRS.getMapProjection(nad27Tennessee) instanceof LambertConformal1SP);
}

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

@Test
public void testSpheroidalWKTParameters() {
  ParameterValueGroup parameters =
      CRS.getMapProjection(sphericalGeosCRS).getParameterValues();
  double satelliteHeight = parameters.parameter("satellite_height").doubleValue();
  assertThat(satelliteHeight, is(35832548.5));
}

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

@Test
public void testEllipsoidalWKTParameters() {
  ParameterValueGroup parameters =
      CRS.getMapProjection(ellipsoidalGeosCRS).getParameterValues();
  double satelliteHeight = parameters.parameter("satellite_height").doubleValue();
  assertThat(satelliteHeight, is(35785831.0));
}

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

@Test
public void testPolarStereographic() throws Exception {
  ReferencedEnvelope envelope =
      new ReferencedEnvelope(
          -10700000, 14700000, -10700000, 14700000, CRS.decode("EPSG:5041", true));
  ProjectionHandler handler = ProjectionHandlerFinder.getHandler(envelope, WGS84, true);
  assertNotNull(handler);
  assertEquals(envelope, handler.getRenderingEnvelope());
  assertTrue(
      CRS.getMapProjection(envelope.getCoordinateReferenceSystem())
          instanceof PolarStereographic);
}

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

CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem());
if (mapProjection instanceof LambertAzimuthalEqualArea) {
  ParameterValueGroup params = mapProjection.getParameterValues();

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

private static GeneralDirectPosition getProjectionCenterLonLat(
    CoordinateReferenceSystem crs, GeneralDirectPosition centerPt) {
  // set defaults
  centerPt.setOrdinate(0, 0);
  centerPt.setOrdinate(1, 0);
  MapProjection projection = getMapProjection(crs);
  if (projection == null) {
    return centerPt;
  }
  for (GeneralParameterValue gpv : projection.getParameterValues().values()) {
    // for safety
    if (!(gpv instanceof ParameterValue)) {
      continue;
    }
    ParameterValue pv = (ParameterValue) gpv;
    ReferenceIdentifier pvName = pv.getDescriptor().getName();
    if (MapProjection.AbstractProvider.LATITUDE_OF_ORIGIN.getName().equals(pvName)) {
      centerPt.setOrdinate(1, pv.doubleValue());
    } else if (MapProjection.AbstractProvider.LATITUDE_OF_CENTRE.getName().equals(pvName)) {
      centerPt.setOrdinate(1, pv.doubleValue());
    } else if (MapProjection.AbstractProvider.LONGITUDE_OF_CENTRE
        .getName()
        .equals(pvName)) {
      centerPt.setOrdinate(0, pv.doubleValue());
    } else if (MapProjection.AbstractProvider.CENTRAL_MERIDIAN.getName().equals(pvName)) {
      centerPt.setOrdinate(0, pv.doubleValue());
    }
  }
  return centerPt;
}

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

throws FactoryException {
MapProjection mapProjection =
    CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem());
if (renderingEnvelope != null && mapProjection instanceof TransverseMercator) {
  double centralMeridian =

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

throws FactoryException {
MapProjection mapProjection =
    CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem());
if (renderingEnvelope != null && mapProjection instanceof PolarStereographic) {
  final boolean north;

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

throws FactoryException {
MapProjection mapProjection =
    CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem());
if (renderingEnvelope != null && mapProjection instanceof Mercator) {
  ProjectionHandler handler;

代码示例来源: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: geotools/geotools

CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem());
if (mapProjection instanceof LambertConformal
    || mapProjection instanceof EquidistantConic) {

代码示例来源:origin: org.geotools/gt-render

public ProjectionHandler getHandler(ReferencedEnvelope renderingEnvelope, boolean wrap, int maxWraps) {
  MapProjection mapProjection = CRS.getMapProjection(renderingEnvelope
      .getCoordinateReferenceSystem());
  if (renderingEnvelope != null && mapProjection instanceof TransverseMercator) {
    double centralMeridian = mapProjection.getParameterValues().parameter(
        AbstractProvider.CENTRAL_MERIDIAN.getName().getCode()).doubleValue();
    ReferencedEnvelope validArea = new ReferencedEnvelope(centralMeridian - 45,
        centralMeridian + 45, -90, 90, DefaultGeographicCRS.WGS84);
    return new ProjectionHandler(renderingEnvelope, validArea);
  }
  return null;
}

代码示例来源:origin: org.geoserver/gs-wcs2_0

MapProjection mapProjection = CRS.getMapProjection(crs);
if (crs instanceof GeographicCRS || mapProjection instanceof Mercator) {
  double offset;

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

MapProjection sourceProjection = CRS.getMapProjection(sourceCRS);
if (sourceProjection instanceof PolarStereographic
    || (sourceProjection instanceof LambertAzimuthalEqualArea)) {
MapProjection targetProjection = CRS.getMapProjection(targetCRS);
if (targetProjection instanceof PolarStereographic && sourceCRS instanceof GeographicCRS) {
  final CoordinateSystem sourceCS = sourceCRS.getCoordinateSystem();

代码示例来源:origin: org.geotools/gt-render

public ProjectionHandler getHandler(ReferencedEnvelope renderingEnvelope, boolean wrap, int maxWraps) {
  MapProjection mapProjection = CRS.getMapProjection(renderingEnvelope
      .getCoordinateReferenceSystem());
  if (renderingEnvelope != null && mapProjection instanceof Mercator) {
    if(wrap && maxWraps > 0) {
      double centralMeridian = mapProjection.getParameterValues().parameter(
          AbstractProvider.CENTRAL_MERIDIAN.getName().getCode()).doubleValue();
      return new WrappingProjectionHandler(renderingEnvelope, VALID_AREA, centralMeridian, maxWraps);
    } else {
      return new ProjectionHandler(renderingEnvelope, VALID_AREA);
    }
  }
  return null;
}

代码示例来源:origin: org.geotools/gt-render

public ProjectionHandler getHandler(ReferencedEnvelope renderingEnvelope, boolean wrap, int maxWraps) {
  MapProjection mapProjection = CRS.getMapProjection(renderingEnvelope
      .getCoordinateReferenceSystem());
  if (renderingEnvelope != null && mapProjection instanceof PolarStereographic) {

代码示例来源:origin: bcdev/beam

};
final CoordinateReferenceSystem crs = EnviCrsFactory.createCrs(9, parameter, EnviConstants.DATUM_NAME_WGS84, "Meters");
final ParameterValueGroup parameterValues = CRS.getMapProjection(crs).getParameterValues();
final List<GeneralParameterValue> valueList = parameterValues.values();
double[] actualValues = new double[8];

相关文章