org.geotools.referencing.CRS.getMapProjection()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.geotools.referencing.CRS.getMapProjection()方法的一些代码示例,展示了CRS.getMapProjection()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CRS.getMapProjection()方法的具体详情如下:
包路径:org.geotools.referencing.CRS
类名称:CRS
方法名:getMapProjection

CRS.getMapProjection介绍

[英]Returns the MapProjection driving the specified crs, or null if none could be found.
[中]返回驱动指定CR的MapProjection,如果找不到,则返回null。

代码示例

代码示例来源:origin: geotools/geotools

  1. public ProjectionHandler getHandler(
  2. ReferencedEnvelope renderingEnvelope,
  3. CoordinateReferenceSystem sourceCrs,
  4. boolean wrap,
  5. int maxWraps)
  6. throws FactoryException {
  7. if (renderingEnvelope == null) {
  8. return null;
  9. }
  10. MapProjection mapProjection =
  11. CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem());
  12. if (mapProjection instanceof WorldVanDerGrintenI) {
  13. ReferencedEnvelope validArea =
  14. new ReferencedEnvelope(
  15. -Integer.MAX_VALUE,
  16. Integer.MAX_VALUE,
  17. -90,
  18. 90,
  19. DefaultGeographicCRS.WGS84);
  20. return new ProjectionHandler(sourceCrs, validArea, renderingEnvelope);
  21. }
  22. return null;
  23. }
  24. }

代码示例来源:origin: geotools/geotools

  1. public void testGetMapProjection() throws Exception {
  2. CoordinateReferenceSystem utm32OnLonLat = CRS.decode("EPSG:23032", true);
  3. assertTrue(CRS.getMapProjection(utm32OnLonLat) instanceof TransverseMercator);
  4. CoordinateReferenceSystem utm32OnLatLon = CRS.decode("EPSG:23032", false);
  5. assertTrue(CRS.getMapProjection(utm32OnLatLon) instanceof TransverseMercator);
  6. CoordinateReferenceSystem nad27Tennessee = CRS.decode("EPSG:2062", false);
  7. assertTrue(CRS.getMapProjection(nad27Tennessee) instanceof LambertConformal1SP);
  8. }

代码示例来源:origin: geotools/geotools

  1. @Test
  2. public void testSpheroidalWKTParameters() {
  3. ParameterValueGroup parameters =
  4. CRS.getMapProjection(sphericalGeosCRS).getParameterValues();
  5. double satelliteHeight = parameters.parameter("satellite_height").doubleValue();
  6. assertThat(satelliteHeight, is(35832548.5));
  7. }

代码示例来源:origin: geotools/geotools

  1. @Test
  2. public void testEllipsoidalWKTParameters() {
  3. ParameterValueGroup parameters =
  4. CRS.getMapProjection(ellipsoidalGeosCRS).getParameterValues();
  5. double satelliteHeight = parameters.parameter("satellite_height").doubleValue();
  6. assertThat(satelliteHeight, is(35785831.0));
  7. }

代码示例来源:origin: geotools/geotools

  1. @Test
  2. public void testPolarStereographic() throws Exception {
  3. ReferencedEnvelope envelope =
  4. new ReferencedEnvelope(
  5. -10700000, 14700000, -10700000, 14700000, CRS.decode("EPSG:5041", true));
  6. ProjectionHandler handler = ProjectionHandlerFinder.getHandler(envelope, WGS84, true);
  7. assertNotNull(handler);
  8. assertEquals(envelope, handler.getRenderingEnvelope());
  9. assertTrue(
  10. CRS.getMapProjection(envelope.getCoordinateReferenceSystem())
  11. instanceof PolarStereographic);
  12. }

代码示例来源:origin: geotools/geotools

  1. CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem());
  2. if (mapProjection instanceof LambertAzimuthalEqualArea) {
  3. ParameterValueGroup params = mapProjection.getParameterValues();

代码示例来源:origin: geotools/geotools

  1. private static GeneralDirectPosition getProjectionCenterLonLat(
  2. CoordinateReferenceSystem crs, GeneralDirectPosition centerPt) {
  3. // set defaults
  4. centerPt.setOrdinate(0, 0);
  5. centerPt.setOrdinate(1, 0);
  6. MapProjection projection = getMapProjection(crs);
  7. if (projection == null) {
  8. return centerPt;
  9. }
  10. for (GeneralParameterValue gpv : projection.getParameterValues().values()) {
  11. // for safety
  12. if (!(gpv instanceof ParameterValue)) {
  13. continue;
  14. }
  15. ParameterValue pv = (ParameterValue) gpv;
  16. ReferenceIdentifier pvName = pv.getDescriptor().getName();
  17. if (MapProjection.AbstractProvider.LATITUDE_OF_ORIGIN.getName().equals(pvName)) {
  18. centerPt.setOrdinate(1, pv.doubleValue());
  19. } else if (MapProjection.AbstractProvider.LATITUDE_OF_CENTRE.getName().equals(pvName)) {
  20. centerPt.setOrdinate(1, pv.doubleValue());
  21. } else if (MapProjection.AbstractProvider.LONGITUDE_OF_CENTRE
  22. .getName()
  23. .equals(pvName)) {
  24. centerPt.setOrdinate(0, pv.doubleValue());
  25. } else if (MapProjection.AbstractProvider.CENTRAL_MERIDIAN.getName().equals(pvName)) {
  26. centerPt.setOrdinate(0, pv.doubleValue());
  27. }
  28. }
  29. return centerPt;
  30. }

代码示例来源:origin: geotools/geotools

  1. throws FactoryException {
  2. MapProjection mapProjection =
  3. CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem());
  4. if (renderingEnvelope != null && mapProjection instanceof TransverseMercator) {
  5. double centralMeridian =

代码示例来源:origin: geotools/geotools

  1. throws FactoryException {
  2. MapProjection mapProjection =
  3. CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem());
  4. if (renderingEnvelope != null && mapProjection instanceof PolarStereographic) {
  5. final boolean north;

代码示例来源:origin: geotools/geotools

  1. throws FactoryException {
  2. MapProjection mapProjection =
  3. CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem());
  4. if (renderingEnvelope != null && mapProjection instanceof Mercator) {
  5. ProjectionHandler handler;

代码示例来源:origin: geotools/geotools

  1. /** Circumscribed rectangle (smallest) for full disk earth image */
  2. public static Envelope2D circumscribeFullDisk(CoordinateReferenceSystem geosCRS)
  3. throws TransformException, FactoryException {
  4. if (!isGeostationaryCRS(geosCRS)) {
  5. return null;
  6. }
  7. MathTransform mt =
  8. CRS.findMathTransform(geosCRS, CRS.getProjectedCRS(geosCRS).getBaseCRS(), true);
  9. MathTransform imt = mt.inverse();
  10. ParameterValueGroup parameters = CRS.getMapProjection(geosCRS).getParameterValues();
  11. double semiMajorAxis = parameters.parameter("semi_major").doubleValue();
  12. double satelliteHeight = parameters.parameter("satellite_height").doubleValue();
  13. double centralMeridian = parameters.parameter("central_meridian").doubleValue();
  14. DirectPosition2D dp2d = new DirectPosition2D();
  15. double halfFoVRadians = Math.acos(semiMajorAxis / (satelliteHeight + semiMajorAxis));
  16. double halfFoVDegrees = Math.toDegrees(halfFoVRadians);
  17. dp2d.setLocation(centralMeridian - halfFoVDegrees, 0.);
  18. imt.transform(dp2d, dp2d);
  19. double xMin = dp2d.getX();
  20. dp2d.setLocation(centralMeridian + halfFoVDegrees, 0.);
  21. imt.transform(dp2d, dp2d);
  22. double xMax = dp2d.getX();
  23. dp2d.setLocation(centralMeridian, -halfFoVDegrees);
  24. imt.transform(dp2d, dp2d);
  25. double yMin = dp2d.getY();
  26. dp2d.setLocation(centralMeridian, halfFoVDegrees);
  27. imt.transform(dp2d, dp2d);
  28. double yMax = dp2d.getY();
  29. return new Envelope2D(geosCRS, xMin, yMin, xMax - xMin, yMax - yMin);
  30. }

代码示例来源:origin: geotools/geotools

  1. CRS.getMapProjection(renderingEnvelope.getCoordinateReferenceSystem());
  2. if (mapProjection instanceof LambertConformal
  3. || mapProjection instanceof EquidistantConic) {

代码示例来源:origin: org.geotools/gt-render

  1. public ProjectionHandler getHandler(ReferencedEnvelope renderingEnvelope, boolean wrap, int maxWraps) {
  2. MapProjection mapProjection = CRS.getMapProjection(renderingEnvelope
  3. .getCoordinateReferenceSystem());
  4. if (renderingEnvelope != null && mapProjection instanceof TransverseMercator) {
  5. double centralMeridian = mapProjection.getParameterValues().parameter(
  6. AbstractProvider.CENTRAL_MERIDIAN.getName().getCode()).doubleValue();
  7. ReferencedEnvelope validArea = new ReferencedEnvelope(centralMeridian - 45,
  8. centralMeridian + 45, -90, 90, DefaultGeographicCRS.WGS84);
  9. return new ProjectionHandler(renderingEnvelope, validArea);
  10. }
  11. return null;
  12. }

代码示例来源:origin: org.geoserver/gs-wcs2_0

  1. MapProjection mapProjection = CRS.getMapProjection(crs);
  2. if (crs instanceof GeographicCRS || mapProjection instanceof Mercator) {
  3. double offset;

代码示例来源:origin: geotools/geotools

  1. MapProjection sourceProjection = CRS.getMapProjection(sourceCRS);
  2. if (sourceProjection instanceof PolarStereographic
  3. || (sourceProjection instanceof LambertAzimuthalEqualArea)) {
  4. MapProjection targetProjection = CRS.getMapProjection(targetCRS);
  5. if (targetProjection instanceof PolarStereographic && sourceCRS instanceof GeographicCRS) {
  6. final CoordinateSystem sourceCS = sourceCRS.getCoordinateSystem();

代码示例来源:origin: org.geotools/gt-render

  1. public ProjectionHandler getHandler(ReferencedEnvelope renderingEnvelope, boolean wrap, int maxWraps) {
  2. MapProjection mapProjection = CRS.getMapProjection(renderingEnvelope
  3. .getCoordinateReferenceSystem());
  4. if (renderingEnvelope != null && mapProjection instanceof Mercator) {
  5. if(wrap && maxWraps > 0) {
  6. double centralMeridian = mapProjection.getParameterValues().parameter(
  7. AbstractProvider.CENTRAL_MERIDIAN.getName().getCode()).doubleValue();
  8. return new WrappingProjectionHandler(renderingEnvelope, VALID_AREA, centralMeridian, maxWraps);
  9. } else {
  10. return new ProjectionHandler(renderingEnvelope, VALID_AREA);
  11. }
  12. }
  13. return null;
  14. }

代码示例来源:origin: org.geotools/gt-render

  1. public ProjectionHandler getHandler(ReferencedEnvelope renderingEnvelope, boolean wrap, int maxWraps) {
  2. MapProjection mapProjection = CRS.getMapProjection(renderingEnvelope
  3. .getCoordinateReferenceSystem());
  4. if (renderingEnvelope != null && mapProjection instanceof PolarStereographic) {

代码示例来源:origin: bcdev/beam

  1. };
  2. final CoordinateReferenceSystem crs = EnviCrsFactory.createCrs(9, parameter, EnviConstants.DATUM_NAME_WGS84, "Meters");
  3. final ParameterValueGroup parameterValues = CRS.getMapProjection(crs).getParameterValues();
  4. final List<GeneralParameterValue> valueList = parameterValues.values();
  5. double[] actualValues = new double[8];

相关文章