Uploaded image for project: 'GeoTools'
  1. GeoTools
  2. GEOT-5336

RendererUtilities.calculateScale() fails to calculate the correct scale if the envelope stays in northern hemisphere

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 14.1
    • Fix Version/s: 17-beta
    • Component/s: render
    • Labels:
      None

      Description

      I wrote a simple Testcate to demonstrate the Problem:

      public void testWorldNorthernHemisphere() throws Exception {
            CoordinateReferenceSystem wgs84 = CRS.decode("EPSG:4326", true);
            ReferencedEnvelope re = new ReferencedEnvelope(new Envelope(-72.0, 132.0, 4.0, 70.0), wgs84);
            double scale = RendererUtilities.calculateScale(re, 1000, 500, 75);
            assertTrue(scale > 1.0d);
        }
      

      The method RendererUtilities.calculateScale() returns for this envelope the wrong scale of 0.0. The scale is correct if I set the y1 coordinate below equator (from 4.0 to -4.0):

      ReferencedEnvelope re = new ReferencedEnvelope(new Envelope(-72.0, 132.0, -4.0, 70.0), wgs84);
      

        Attachments

          Activity

            People

            • Assignee:
              ianturton Ian Turton
              Reporter:
              andrej.aschenbrenner Andrej Aschenbrenner
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: