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

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

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

origin: opentripplanner/OpenTripPlanner

if (CRS.getAxisOrder(destCrs) == CRS.AxisOrder.NORTH_EAST)
  latLon = true;
else if (CRS.getAxisOrder(destCrs) == CRS.AxisOrder.EAST_NORTH)
  latLon = false;
else
origin: geotools/geotools

/**
 * Determines the axis ordering of a specified crs object.
 *
 * @param crs The coordinate reference system.
 * @return One of {@link AxisOrder#EAST_NORTH}, {@link AxisOrder@NORTH_EAST}, or {@link
 *     AxisOrder#INAPPLICABLE}
 * @see AxisOrder
 * @since 2.7
 */
public static AxisOrder getAxisOrder(CoordinateReferenceSystem crs) {
  return getAxisOrder(crs, false);
}
origin: geotools/geotools

private static org.opengis.geometry.Envelope getCRSEnvelope(CoordinateReferenceSystem targetCRS)
    throws FactoryException, NoSuchAuthorityCodeException {
  if (targetCRS.getDomainOfValidity() == null) {
    Integer code = CRS.lookupEpsgCode(targetCRS, true);
    if (code != null) {
      CRS.decode("EPSG:" + code, CRS.getAxisOrder(targetCRS) != AxisOrder.NORTH_EAST);
    }
  }
  org.opengis.geometry.Envelope envelope = CRS.getEnvelope(targetCRS);
  return envelope;
}
origin: geotools/geotools

CoordinateReferenceSystem crs = CRS.decode(srsName, true);
if (CRS.getAxisOrder(crs) == AxisOrder.NORTH_EAST) {
  Integer epsgCode = CRS.lookupEpsgCode(crs, false);
  if (epsgCode == null) {
origin: geotools/geotools

/**
 * Checks if axis flipping is needed comparing axis order requested for the DataStore with query
 * crs.
 *
 * @param axisOrder
 * @param coordinateSystem
 * @return
 */
public static boolean invertAxisNeeded(String axisOrder, CoordinateReferenceSystem crs) {
  CRS.AxisOrder requestedAxis = CRS.getAxisOrder(crs);
  if (requestedAxis == CRS.AxisOrder.INAPPLICABLE) {
    boolean forcedLonLat =
        Boolean.getBoolean("org.geotools.referencing.forceXY")
            || Boolean.TRUE.equals(
                Hints.getSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER));
    if (forcedLonLat) {
      requestedAxis = CRS.AxisOrder.EAST_NORTH;
    } else {
      requestedAxis = CRS.AxisOrder.NORTH_EAST;
    }
  }
  if (WFSDataStoreFactory.AXIS_ORDER_NORTH_EAST.equals(axisOrder)) {
    return requestedAxis.equals(CRS.AxisOrder.EAST_NORTH);
  } else if (WFSDataStoreFactory.AXIS_ORDER_EAST_NORTH.equals(axisOrder)) {
    return requestedAxis.equals(CRS.AxisOrder.NORTH_EAST);
  } else {
    return false; // compliant, don't do anything
  }
}
origin: geotools/geotools

protected void setCentralMeridian(double centralMeridian) {
  // compute the earth radius
  try {
    CoordinateReferenceSystem targetCRS = renderingEnvelope.getCoordinateReferenceSystem();
    MathTransform mt = CRS.findMathTransform(WGS84, targetCRS, true);
    double[] src = new double[] {centralMeridian, 0, 180 + centralMeridian, 0};
    double[] dst = new double[4];
    mt.transform(src, 0, dst, 0, 2);
    if (CRS.getAxisOrder(targetCRS) == CRS.AxisOrder.NORTH_EAST) {
      radius = Math.abs(dst[3] - dst[1]);
    } else {
      radius = Math.abs(dst[2] - dst[0]);
    }
    if (radius <= 0) {
      throw new RuntimeException("Computed Earth radius is 0, what is going on?");
    }
  } catch (Exception e) {
    throw new RuntimeException(
        "Unexpected error computing the Earth radius " + "in the current projection",
        e);
  }
  computeDatelineX();
}
origin: geotools/geotools

  return null;
if (isForcedLonLat() && CRS.getAxisOrder(crs, false) == AxisOrder.NORTH_EAST) {
  try {
origin: geotools/geotools

public void testSRSAxisOrder2() throws Exception {
  try {
    Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
    CoordinateReferenceSystem crsEN = CRS.decode("EPSG:4326");
    assertEquals(AxisOrder.EAST_NORTH, CRS.getAxisOrder(crsEN));
    CoordinateReferenceSystem crsNE = CRS.decode("urn:ogc:def:crs:EPSG::4326");
    assertEquals(AxisOrder.NORTH_EAST, CRS.getAxisOrder(crsNE));
  } finally {
    Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER);
  }
}
origin: geotools/geotools

if (CRS.getAxisOrder(this.crs) == CRS.AxisOrder.NORTH_EAST) {
origin: geotools/geotools

/** Encodes the given geometry with no srsName attribute and forcing 2D */
public void encode(Geometry geometry) {
  String srsName = null;
  // see if we have a EPSG CRS attached to the geometry
  if (geometry.getUserData() instanceof CoordinateReferenceSystem) {
    try {
      CoordinateReferenceSystem crs =
          (CoordinateReferenceSystem) geometry.getUserData();
      Integer code = CRS.lookupEpsgCode(crs, false);
      if (code != null) {
        if (AxisOrder.NORTH_EAST.equals(CRS.getAxisOrder(crs))) {
          srsName = "urn:ogc:def:crs:EPSG::" + code;
        } else {
          srsName = "EPSG:" + code;
        }
      }
    } catch (Exception e) {
      LOGGER.fine("Failed to encode the CoordinateReferenceSystem into a srsName");
    }
  }
  encode(geometry, srsName);
}
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

        || CRS.getAxisOrder(crs).equals(AxisOrder.NORTH_EAST);
swapAxes &= !retainAxesOrder;
origin: geotools/geotools

/**
 * @param lon
 * @param lat
 */
public void setTopLeft(double lon, double lat) {
  boolean isLongitudeFirstAxisOrderForced =
      Boolean.getBoolean(GeoTools.FORCE_LONGITUDE_FIRST_AXIS_ORDER)
          || GeoTools.getDefaultHints().get(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER)
              == Boolean.TRUE;
  CoordinateReferenceSystem crs = getCrs();
  if (isLongitudeFirstAxisOrderForced
      || (crs != null && CRS.getAxisOrder(crs).equals(CRS.AxisOrder.EAST_NORTH))) {
    topLeft = gf.createPoint(new Coordinate(lon, lat));
    return;
  } else {
    // guess lat/lon?
    topLeft = gf.createPoint(new Coordinate(lat, lon));
  }
}
origin: geotools/geotools

@BeforeClass
public static void setupCRS() throws FactoryException {
  CRS.reset("all");
  Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
  // the following is only to make the test work in Eclipse, where the test
  // classpath is tainted by the test classpath of dependent modules (whilst in Maven it's
  // not)
  Set<CRSAuthorityFactory> factories =
      ReferencingFactoryFinder.getCRSAuthorityFactories(null);
  for (CRSAuthorityFactory factory : factories) {
    if (factory.getClass().getSimpleName().equals("EPSGCRSAuthorityFactory")) {
      ReferencingFactoryFinder.removeAuthorityFactory(factory);
    }
  }
  assertEquals(
      AxisOrder.NORTH_EAST, CRS.getAxisOrder(CRS.decode("urn:ogc:def:crs:EPSG::4326")));
}
origin: geotools/geotools

ReferencedEnvelope readerEnvelope =
    ReferencedEnvelope.reference(reader.getOriginalEnvelope());
boolean northEast = CRS.getAxisOrder(readerCRS) == AxisOrder.NORTH_EAST;
int lonAxis = northEast ? 1 : 0;
if (readerEnvelope.getMaximum(lonAxis) > 180) {
origin: geotools/geotools

  CRS.reset("all");
  Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
  assertEquals(AxisOrder.EAST_NORTH, CRS.getAxisOrder(CRS.decode("EPSG:4326", false)));
  assertEquals(AxisOrder.EAST_NORTH, CRS.getAxisOrder(CRS.decode("EPSG:4326", true)));
  assertEquals(
      AxisOrder.NORTH_EAST,
      CRS.getAxisOrder(CRS.decode("urn:x-ogc:def:crs:EPSG::4326", false)));
  assertEquals(
      AxisOrder.NORTH_EAST,
      CRS.getAxisOrder(CRS.decode("urn:x-ogc:def:crs:EPSG::4326", true)));
} finally {
  Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER);
  assertEquals(AxisOrder.NORTH_EAST, CRS.getAxisOrder(CRS.decode("EPSG:4326", false)));
  assertEquals(AxisOrder.EAST_NORTH, CRS.getAxisOrder(CRS.decode("EPSG:4326", true)));
  assertEquals(
      AxisOrder.NORTH_EAST,
      CRS.getAxisOrder(CRS.decode("urn:x-ogc:def:crs:EPSG::4326", false)));
  assertEquals(
      AxisOrder.NORTH_EAST,
      CRS.getAxisOrder(CRS.decode("urn:x-ogc:def:crs:EPSG::4326", true)));
} finally {
  CRS.reset("all");
  System.setProperty("org.geotools.referencing.forceXY", "true");
  assertEquals(AxisOrder.EAST_NORTH, CRS.getAxisOrder(CRS.decode("EPSG:4326", false)));
  assertEquals(AxisOrder.EAST_NORTH, CRS.getAxisOrder(CRS.decode("EPSG:4326", true)));
  assertEquals(
      AxisOrder.NORTH_EAST,
origin: geotools/geotools

        + "AXIS[\"Geodetic longitude\", EAST],"
        + "AXIS[\"Geodetic latitude\", NORTH]]";
assertEquals(AxisOrder.LON_LAT, CRS.getAxisOrder(CRS.parseWKT(wkt)));
assertEquals(AxisOrder.EAST_NORTH, CRS.getAxisOrder(CRS.parseWKT(wkt)));
        + "AXIS[\"Geodetic latitude\", NORTH],"
        + "AXIS[\"Geodetic longitude\", EAST]]";
assertEquals(AxisOrder.LAT_LON, CRS.getAxisOrder(CRS.parseWKT(wkt)));
assertEquals(AxisOrder.NORTH_EAST, CRS.getAxisOrder(CRS.parseWKT(wkt)));
    CRS.getAxisOrder(CRS.getHorizontalCRS(DefaultEngineeringCRS.GENERIC_2D)));
        + "  AXIS[\"Northing\", NORTH], "
        + "  AUTHORITY[\"EPSG\",\"23031\"]]";
assertEquals(AxisOrder.EAST_NORTH, CRS.getAxisOrder(CRS.parseWKT(wkt)));
assertEquals(AxisOrder.NORTH_EAST, CRS.getAxisOrder(CRS.parseWKT(wkt), true));
origin: geotools/geotools

AxisOrder axisOrder = CRS.getAxisOrder(crs, true);
origin: geotools/geotools

if (CRS.getAxisOrder(sourceCrs) == AxisOrder.NORTH_EAST) {
  validArea =
      new ReferencedEnvelope(
origin: geotools/geotools

@Test
public void testGDA94Points() throws Exception {
  Style style = RendererBaseTest.loadStyle(this, "markCircle.sld");
  BufferedImage reference = toImage(point_test_2d, style);
  BufferedImage actual = null;
  if (CRS.getAxisOrder(point_test_strict.getSchema().getCoordinateReferenceSystem())
      == AxisOrder.NORTH_EAST) {
    actual = toImage(point_test_strict, style);
  }
  if (CRS.getAxisOrder(point_test.getSchema().getCoordinateReferenceSystem())
      == AxisOrder.EAST_NORTH) {
    actual = toImage(point_test, style);
  }
  ImageAssert.assertEquals(reference, actual, 10);
}
org.geotools.referencingCRSgetAxisOrder

Javadoc

Determines the axis ordering of a specified crs object.

Popular methods of CRS

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

Popular in Java

  • Running tasks concurrently on multiple threads
  • onCreateOptionsMenu (Activity)
  • addToBackStack (FragmentTransaction)
  • compareTo (BigDecimal)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Permission (java.security)
    Legacy security code; do not use.
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Best IntelliJ plugins
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