Tabnine Logo
CRS.getProjectedCRS
Code IndexAdd Tabnine to your IDE (free)

How to use
getProjectedCRS
method
in
org.geotools.referencing.CRS

Best Java code snippets using org.geotools.referencing.CRS.getProjectedCRS (Showing top 8 results out of 315)

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;
  }
}
org.geotools.referencingCRSgetProjectedCRS

Javadoc

Returns the first projected coordinate reference system found in a the given CRS, or null if there is none.

Popular methods of CRS

  • decode
  • findMathTransform
  • equalsIgnoreMetadata
  • parseWKT
  • lookupEpsgCode
  • transform
  • getAxisOrder
  • lookupIdentifier
  • toSRS
  • getHorizontalCRS
  • getEnvelope
  • getCoordinateOperationFactory
  • getEnvelope,
  • getCoordinateOperationFactory,
  • getAuthorityFactory,
  • getMapProjection,
  • getSupportedCodes,
  • getGeographicBoundingBox,
  • reset,
  • getEllipsoid,
  • getTemporalCRS

Popular in Java

  • Start an intent from android
  • setScale (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now