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

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

Best Java code snippets using org.geotools.referencing.CRS.equalsIgnoreMetadata (Showing top 20 results out of 666)

origin: geoserver/geoserver

/** Helper method for transforming an envelope. */
private static ReferencedEnvelope transform(ReferencedEnvelope e, CoordinateReferenceSystem crs)
    throws TransformException, FactoryException {
  if (!CRS.equalsIgnoreMetadata(crs, e.getCoordinateReferenceSystem())) {
    return e.transform(crs, true);
  }
  return e;
}
origin: geoserver/geoserver

/**
 * Computes the geographic bounds of a {@link ResourceInfo} by reprojecting the available native
 * bounds
 *
 * @param rinfo
 * @return the geographic bounds, or null if the native bounds are not available
 * @throws IOException
 */
public ReferencedEnvelope getLatLonBounds(
    ReferencedEnvelope nativeBounds, CoordinateReferenceSystem declaredCRS)
    throws IOException {
  if (nativeBounds != null && declaredCRS != null) {
    // make sure we use the declared CRS, not the native one, the may differ
    if (!CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, declaredCRS)) {
      // transform
      try {
        ReferencedEnvelope bounds =
            new ReferencedEnvelope(nativeBounds, CRS.getHorizontalCRS(declaredCRS));
        return bounds.transform(DefaultGeographicCRS.WGS84, true);
      } catch (Exception e) {
        throw (IOException) new IOException("transform error").initCause(e);
      }
    } else {
      return new ReferencedEnvelope(nativeBounds, DefaultGeographicCRS.WGS84);
    }
  }
  return null;
}
origin: geoserver/geoserver

CoordinateReferenceSystem crs1 = e1.getCoordinateReferenceSystem();
CoordinateReferenceSystem crs2 = e2.getCoordinateReferenceSystem();
if (crs1 != crs2 && !CRS.equalsIgnoreMetadata(crs1, crs2)) {
  throw new RuntimeException(
      "Two collections are returning different CRSs, cannot perform this "
origin: geoserver/geoserver

if (CRS.equalsIgnoreMetadata(sourceCRS, DefaultGeographicCRS.WGS84)) {
  return new GeneralEnvelope(envelope);
if (!CRS.equalsIgnoreMetadata(sourceCRS, targetCRS)) {
  targetEnvelope = CRS.transform(envelope, targetCRS);
} else {
origin: geoserver/geoserver

if (!CRS.equalsIgnoreMetadata(sourceCRS, destCRS)) {
  try {
    envelope = CRS.transform(envelope, destCRS);
origin: geoserver/geoserver

if (!CRS.equalsIgnoreMetadata(crs, this.crs)) {
  try {
    destinationToSourceTransform = CRS.findMathTransform(crs, this.crs, true);
origin: geoserver/geoserver

public ReferencedEnvelope boundingBox() throws Exception {
  CoordinateReferenceSystem declaredCRS = getCRS();
  CoordinateReferenceSystem nativeCRS = getNativeCRS();
  ProjectionPolicy php = getProjectionPolicy();
  ReferencedEnvelope nativeBox = this.nativeBoundingBox;
  if (nativeBox == null) {
    // back project from lat lon
    try {
      nativeBox = getLatLonBoundingBox().transform(declaredCRS, true);
    } catch (Exception e) {
      LOGGER.log(Level.WARNING, "Failed to derive native bbox from declared one", e);
      return null;
    }
  }
  ReferencedEnvelope result;
  if (!CRS.equalsIgnoreMetadata(declaredCRS, nativeCRS)
      && php == ProjectionPolicy.REPROJECT_TO_DECLARED) {
    result = nativeBox.transform(declaredCRS, true);
  } else if (php == ProjectionPolicy.FORCE_DECLARED) {
    result = ReferencedEnvelope.create((Envelope) nativeBox, declaredCRS);
  } else {
    result = nativeBox;
  }
  // make sure that in no case the actual field value is returned to the client, this
  // is not a getter, it's a derivative, thus ModificationProxy won't do a copy on its own
  return ReferencedEnvelope.create(result);
}
origin: geoserver/geoserver

} else {
  if (!CRS.equalsIgnoreMetadata(nativeCRS, targetCRS)) {
    fc = new ReprojectFeatureResults(fc, targetCRS);
origin: geoserver/geoserver

@Test
public void testCRSConverter() throws Exception {
  CoordinateReferenceSystem crs = CRS.decode("EPSG:4326");
  CRSConverter c = new CRSConverter();
  assertEquals(crs.toWKT(), c.toString(crs));
  assertEquals(DefaultGeographicCRS.WGS84.toWKT(), c.toString(DefaultGeographicCRS.WGS84));
  CoordinateReferenceSystem crs2 = (CoordinateReferenceSystem) c.fromString(crs.toWKT());
  assertTrue(CRS.equalsIgnoreMetadata(crs, crs2));
  crs2 = (CoordinateReferenceSystem) c.fromString("EPSG:4326");
  assertTrue(CRS.equalsIgnoreMetadata(crs, crs2));
}
origin: geoserver/geoserver

public SimpleFeatureCollection subCollection(Filter filter) {
  // reproject the filter to the delegate native crs
  CoordinateReferenceSystem crs = getSchema().getCoordinateReferenceSystem();
  CoordinateReferenceSystem crsDelegate = delegate.getSchema().getCoordinateReferenceSystem();
  if (crs != null) {
    DefaultCRSFilterVisitor defaulter = new DefaultCRSFilterVisitor(FF, crs);
    filter = (Filter) filter.accept(defaulter, null);
    if (crsDelegate != null && !CRS.equalsIgnoreMetadata(crs, crsDelegate)) {
      ReprojectingFilterVisitor reprojector =
          new ReprojectingFilterVisitor(FF, delegate.getSchema());
      filter = (Filter) filter.accept(reprojector, null);
    }
  }
  SimpleFeatureCollection sub = delegate.subCollection(filter);
  if (sub != null) {
    try {
      ReprojectingFeatureCollection wrapper =
          new ReprojectingFeatureCollection(sub, target);
      wrapper.setDefaultSource(defaultSource);
      return wrapper;
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
  return null;
}
origin: geoserver/geoserver

if (nativeCRS == null) {
  if (other.getNativeCRS() != null) return false;
} else if (!CRS.equalsIgnoreMetadata(nativeCRS, other.getNativeCRS())) return false;
if (nativeName == null) {
  if (other.getNativeName() != null) return false;
origin: geoserver/geoserver

@Test
public void testWgs84BoundsFromCompoundCRS() throws Exception {
  try {
    MapProjection.SKIP_SANITY_CHECKS = true;
    CatalogBuilder cb = new CatalogBuilder(getCatalog());
    ReferencedEnvelope3D bounds =
        new ReferencedEnvelope3D(
            142892, 470783, 16, 142900, 470790, 20, CRS.decode("EPSG:7415"));
    // used to throw an exception here
    ReferencedEnvelope latLonBounds =
        cb.getLatLonBounds(bounds, bounds.getCoordinateReferenceSystem());
    assertTrue(
        CRS.equalsIgnoreMetadata(
            CRS.decode("EPSG:4326"), latLonBounds.getCoordinateReferenceSystem()));
    // System.out.println(latLonBounds);
  } finally {
    MapProjection.SKIP_SANITY_CHECKS = false;
  }
}
origin: geoserver/geoserver

@Test
public void testCRSConverterInvalidWKT() throws Exception {
  CoordinateReferenceSystem crs = CRS.decode("EPSG:3575");
  try {
    ((Formattable) crs).toWKT(2, true);
    fail("expected exception");
  } catch (UnformattableObjectException e) {
  }
  String wkt = null;
  try {
    wkt = new CRSConverter().toString(crs);
  } catch (UnformattableObjectException e) {
    fail("Should have thrown exception");
  }
  CoordinateReferenceSystem crs2 =
      (CoordinateReferenceSystem) new CRSConverter().fromString(wkt);
  assertTrue(CRS.equalsIgnoreMetadata(crs, crs2));
}
origin: geoserver/geoserver

r = (GridCoverage2DReader) ci.getGridCoverageReader(null, GeoTools.getDefaultHints());
assertTrue(
    CRS.equalsIgnoreMetadata(
        CRS.decode("EPSG:3857"), r.getCoordinateReferenceSystem()));
    CRS.equalsIgnoreMetadata(
        CRS.decode("EPSG:3857"), r.getCoordinateReferenceSystem()));
r = (GridCoverage2DReader) rpool.getGridCoverageReader(store, GeoTools.getDefaultHints());
assertTrue(
    CRS.equalsIgnoreMetadata(
        CRS.decode("EPSG:4326"), r.getCoordinateReferenceSystem()));
origin: geoserver/geoserver

    requestedEnvelope.getCoordinateReferenceSystem();
final CoordinateReferenceSystem nativeCRS = reader.getCoordinateReferenceSystem();
if (!CRS.equalsIgnoreMetadata(requestCRS, nativeCRS)) {
  requestedEnvelope = CRS.transform(requestedEnvelope, nativeCRS);
origin: geoserver/geoserver

  if (!CRS.equalsIgnoreMetadata(resultCRS, schema.getCoordinateReferenceSystem()))
    schema = FeatureTypes.transform(schema, resultCRS);
} catch (Exception e) {
origin: geoserver/geoserver

assertTrue(cv.getParameters().containsKey("foo"));
assertNull(cv.getParameters().get("foo"));
assertTrue(CRS.equalsIgnoreMetadata(CRS.decode("EPSG:4326"), cv.getNativeCRS()));
origin: geoserver/geoserver

assertEquals(ns, wl.getNamespace());
assertEquals("EPSG:4326", wl.getSRS());
assertTrue(CRS.equalsIgnoreMetadata(CRS.decode("EPSG:4326"), wl.getNativeCRS()));
origin: geoserver/geoserver

assertEquals(ns, wl.getNamespace());
assertEquals("EPSG:4326", wl.getSRS());
assertTrue(CRS.equalsIgnoreMetadata(CRS.decode("EPSG:4326"), wl.getNativeCRS()));
origin: geoserver/geoserver

assertEquals("EPSG:4326", ft.getSRS());
assertEquals(new Measure(10, SI.METRE), ft.getLinearizationTolerance());
assertTrue(CRS.equalsIgnoreMetadata(CRS.decode("EPSG:4326"), ft.getNativeCRS()));
org.geotools.referencingCRSequalsIgnoreMetadata

Javadoc

Compares the specified objects for equality. If both objects are Geotools implementations of class AbstractIdentifiedObject, then this method will ignore the metadata during the comparaison.

Popular methods of CRS

  • decode
  • findMathTransform
  • parseWKT
  • lookupEpsgCode
  • transform
    Implementation of #transform(MathTransform,Envelope) with the opportunity to save the projected cent
  • getAxisOrder
  • lookupIdentifier
  • toSRS
  • getHorizontalCRS
  • getEnvelope
  • getCoordinateOperationFactory
  • getAuthorityFactory
  • getCoordinateOperationFactory,
  • getAuthorityFactory,
  • getMapProjection,
  • getSupportedCodes,
  • getGeographicBoundingBox,
  • reset,
  • getEllipsoid,
  • getProjectedCRS,
  • getTemporalCRS

Popular in Java

  • Creating JSON documents from java classes using gson
  • putExtra (Intent)
  • startActivity (Activity)
  • scheduleAtFixedRate (Timer)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • 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