1212public class ScaleTest {
1313 public static final CoordinateReferenceSystem SPHERICAL_MERCATOR ;
1414 public static final CoordinateReferenceSystem CH1903 ;
15+ public static final CoordinateReferenceSystem CH2056 ;
1516 private static final double DELTA = 0.00001 ;
1617 private static final double SCALE = 108335.72891406555 ;
1718 private static final double RESOLUTION = 38.21843770023979 ;
@@ -20,6 +21,7 @@ public class ScaleTest {
2021 try {
2122 SPHERICAL_MERCATOR = CRS .decode ("EPSG:3857" );
2223 CH1903 = CRS .decode ("EPSG:21781" );
24+ CH2056 = CRS .decode ("EPSG:2056" );
2325 } catch (FactoryException e ) {
2426 throw new RuntimeException (e );
2527 }
@@ -47,4 +49,29 @@ public void geodetic() {
4749 10019.0 ,
4850 1.0 );
4951 }
52+
53+ /**
54+ * This test verifies that the geodetic scale calculation correctly uses position.x for the
55+ * horizontal coordinate. In projections like CH2056 (Swiss Oblique Mercator) or UTM, shifting a
56+ * point in X direction while keeping Y constant affects the geodetic distance, unlike EPSG:3857
57+ * where distortion is primarily latitude-dependent.
58+ *
59+ * <p>With some other projection like EPSG:5936 WGS 84 / EPSG Alaska Polar Stereographic The
60+ * defferance will consequant.
61+ */
62+ @ Test
63+ public void geodeticCH2056XPositionDependence () {
64+ final Scale scale = new Scale (25000.0 , CH2056 , PDF_DPI );
65+
66+ // Calculate geodetic scale at two positions with same Y but different X
67+ // Using coordinates in CH2056 CRS (EPSG:2056)
68+ final Coordinate positionRef = new Coordinate (2600000.0 , 1200000.0 );
69+ final Coordinate positionLeft = new Coordinate (2484274.0 , 1200000.0 );
70+
71+ final double geodeticScaleRef = scale .getGeodeticDenominator (CH2056 , PDF_DPI , positionRef );
72+ final double geodeticScaleLeft = scale .getGeodeticDenominator (CH2056 , PDF_DPI , positionLeft );
73+
74+ assertEquals (24996.77190700038 , geodeticScaleRef , 0.0 );
75+ assertEquals (24996.76743516703 , geodeticScaleLeft , 0.0 );
76+ }
5077}
0 commit comments