/** * Inscribed rectangle for for full disk earth image (not largest inscribing rectangle but * close, hence "Estimate") */ public static Envelope2D inscribeFullDiskEstimate(CoordinateReferenceSystem geosCRS) throws TransformException, FactoryException { Envelope2D circumscribed = circumscribeFullDisk(geosCRS); return (circumscribed == null) ? null : doInscribeFullDisk(circumscribed); }
public GeostationarySatellite(ParameterValueGroup parameters) throws ParameterNotFoundException { super(parameters); final Collection<GeneralParameterDescriptor> expected = getParameterDescriptors().descriptors(); // from https://github.com/OSGeo/proj.4/blob/4.9/src/projects.h // a, /* major axis or radius if es==0 */ final double a = semiMajor; h = doubleValue(expected, Provider.SATELLITE_HEIGHT, parameters); // from https://github.com/OSGeo/proj.4/blob/4.9/src/PJ_geos.c // P->radius_g_1 = P->h / P->a; // P->radius_g = 1. + P->radius_g_1; // P->C = P->radius_g * P->radius_g - 1.0; radius_g_1 = h / a; radius_g = 1d + radius_g_1; C = radius_g * radius_g - 1d; }
@Override public ParameterValueGroup getParameterValues() { final ParameterValueGroup values = super.getParameterValues(); final ParameterDescriptorGroup descriptor = getParameterDescriptors(); final Collection<GeneralParameterDescriptor> expected = descriptor.descriptors(); set(expected, Provider.SATELLITE_HEIGHT, values, h); return values; }
@Test public void testIsGeostationaryCRS() { assertThat(GeostationarySatellite.isGeostationaryCRS(sphericalGeosCRS), is(true)); assertThat(GeostationarySatellite.isGeostationaryCRS(ellipsoidalGeosCRS), is(true)); assertThat( GeostationarySatellite.isGeostationaryCRS(DefaultGeographicCRS.WGS84), is(false)); assertThat(GeostationarySatellite.isGeostationaryCRS(null), is(false)); }
GeostationarySatellite.circumscribeFullDisk(ellipsoidalGeosCRS); assertThat(circumscribed, is(notNullValue()));
GeostationarySatellite.inscribeFullDiskEstimate(ellipsoidalGeosCRS); assertThat(inscribed, is(notNullValue()));
/** 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); }
GeostationarySatellite.circumscribeFullDisk(sphericalGeosCRS); assertThat(circumscribed, is(notNullValue()));
GeostationarySatellite.inscribeFullDiskEstimate(sphericalGeosCRS); assertThat(inscribed, is(notNullValue()));