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; } }
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); }
@Test public void testSpheroidalWKTParameters() { ParameterValueGroup parameters = CRS.getMapProjection(sphericalGeosCRS).getParameterValues(); double satelliteHeight = parameters.parameter("satellite_height").doubleValue(); assertThat(satelliteHeight, is(35832548.5)); }
@Test public void testEllipsoidalWKTParameters() { ParameterValueGroup parameters = CRS.getMapProjection(ellipsoidalGeosCRS).getParameterValues(); double satelliteHeight = parameters.parameter("satellite_height").doubleValue(); assertThat(satelliteHeight, is(35785831.0)); }
@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); }
CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem()); if (mapProjection instanceof LambertAzimuthalEqualArea) { ParameterValueGroup params = mapProjection.getParameterValues();
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; }
throws FactoryException { MapProjection mapProjection = CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem()); if (renderingEnvelope != null && mapProjection instanceof TransverseMercator) { double centralMeridian =
throws FactoryException { MapProjection mapProjection = CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem()); if (renderingEnvelope != null && mapProjection instanceof PolarStereographic) { final boolean north;
throws FactoryException { MapProjection mapProjection = CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem()); if (renderingEnvelope != null && mapProjection instanceof Mercator) { ProjectionHandler handler;
/** 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); }
CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem()); if (mapProjection instanceof LambertConformal || mapProjection instanceof EquidistantConic) {
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; }
MapProjection mapProjection = CRS.getMapProjection(crs); if (crs instanceof GeographicCRS || mapProjection instanceof Mercator) { double offset;
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();
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; }
public ProjectionHandler getHandler(ReferencedEnvelope renderingEnvelope, boolean wrap, int maxWraps) { MapProjection mapProjection = CRS.getMapProjection(renderingEnvelope .getCoordinateReferenceSystem()); if (renderingEnvelope != null && mapProjection instanceof PolarStereographic) {
}; 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];