Uploaded image for project: 'Spatial Information Systems'
  1. Spatial Information Systems
  2. SIS-547

Mercator projection should wraparound longitude values

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.6, 0.7, 0.8, 1.0, 1.1, 1.2
    • 1.3
    • Referencing
    • None

    Description

      When the central meridian has a value different than zero, user may expect a range of 180° on the east of central meridian to produce positive easting values and conversely on for 180° on the west of central meridian. This is currently not the case:

      ProjectedCRS crs = (ProjectedCRS) CRS.forCode("EPSG:3994");
      MathTransform prj = crs.getConversionFromBase().getMathTransform();
      double[] coordinates = {-41, 100, -41, 179, -41, 181, -41, -179};
      prj.transform(coordinates, 0, coordinates, 0, 4);
      System.out.println(java.util.Arrays.toString(coordinates));
      

      Output (reformatted for readability):

              0   -3767132
        6646680   -3767132
        6814950   -3767132
      -23473717   -3767132
      

      Other map projection implementations rely on trigonometric functions for applying an implicit wraparound. For example in a call to sin(λ) the λ argument value is implicitly reduced to a range of -π … +π around the λ₀ (central meridian). But it does not happen in the particular case of the Mercator projection, since the Easting value is just a multiplication factor without trigonometric functions involved. So we have to do the wraparound ourselves.

      Attachments

        1. image-2022-07-29-17-16-59-619.png
          41 kB
          Martin Desruisseaux
        2. image-2022-07-29-17-21-47-669.png
          56 kB
          Martin Desruisseaux

        Issue Links

          Activity

            People

              desruisseaux Martin Desruisseaux
              desruisseaux Martin Desruisseaux
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: