Changeset 11660 in josm for trunk/test


Ignore:
Timestamp:
2017-03-04T03:09:43+01:00 (3 years ago)
Author:
Don-vip
Message:

see #5399 - Swissgrid: add NTv2 grid file provided by swisstopo

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java

    r10758 r11660  
    66
    77import org.junit.BeforeClass;
    8 import org.junit.Ignore;
     8import org.junit.Rule;
    99import org.junit.Test;
    1010import org.openstreetmap.josm.Main;
    1111import org.openstreetmap.josm.data.coor.EastNorth;
    1212import org.openstreetmap.josm.data.coor.LatLon;
     13import org.openstreetmap.josm.testutils.JOSMTestRules;
     14
     15import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1316
    1417public class SwissGridTest {
     
    1922     * Setup test.
    2023     */
     24    @Rule
     25    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     26    public JOSMTestRules test = new JOSMTestRules().platform();
     27
     28    /**
     29     * Setup test.
     30     */
    2131    @BeforeClass
    2232    public static void setUp() {
     
    2838
    2939    /**
    30      * source: http://www.swisstopo.admin.ch/internet/swisstopo/en/home/topics/survey/sys/refsys/switzerland.parsysrelated1.37696.downloadList.97912.DownloadFile.tmp/swissprojectionen.pdf
     40     * source: https://www.swisstopo.admin.ch/content/swisstopo-internet/en/topics/survey/reference-systems/projections/_jcr_content/contentPar/tabs/items/dokumente_publikatio/tabPar/downloadlist/downloadItems/463_1459341821844.download/refsyse.pdf
    3141     */
    3242    ProjData[] data = {
     
    5666    }
    5767
    58     private static final double EPSILON_APPROX = 1.5;
    5968    private static final double EPSILON_ACCURATE = 0.05;
    6069
     
    7281
    7382    @Test
    74     public void testProjReferenceTestApprox() {
    75         projReferenceTest(EPSILON_APPROX);
    76     }
    77 
    78     @Test
    79     @Ignore("high accuracy of epsilon=" + EPSILON_ACCURATE + " is not met")
    8083    public void testProjReferenceTestAccurate() {
    81         // TODO make this test pass
    8284        projReferenceTest(EPSILON_ACCURATE);
    8385    }
     
    9092            System.out.println(en);
    9193        }
    92         assertTrue("Lausanne", Math.abs(en.east() - 533111.69) < 0.1);
    93         assertTrue("Lausanne", Math.abs(en.north() - 152227.85) < 0.1);
     94        assertTrue("Lausanne", Math.abs(en.east() - 533112.13) < 0.1);
     95        assertTrue("Lausanne", Math.abs(en.north() - 152227.35) < 0.1);
    9496
    9597        ll = new LatLon(47.78, 8.58);
     
    98100            System.out.println(en);
    99101        }
    100         assertTrue("Schafouse", Math.abs(en.east() - 685544.16) < 0.1);
    101         assertTrue("Schafouse", Math.abs(en.north() - 292782.91) < 0.1);
     102        assertTrue("Schafouse", Math.abs(en.east() - 685542.97) < 0.1);
     103        assertTrue("Schafouse", Math.abs(en.north() - 292783.21) < 0.1);
    102104
    103105        ll = new LatLon(46.58, 10.48);
     
    106108            System.out.println(en);
    107109        }
    108         assertTrue("Grinson", Math.abs(en.east() - 833068.04) < 0.1);
    109         assertTrue("Grinson", Math.abs(en.north() - 163265.39) < 0.1);
     110        assertTrue("Grinson", Math.abs(en.east() - 833066.95) < 0.1);
     111        assertTrue("Grinson", Math.abs(en.north() - 163265.32) < 0.1);
    110112
    111113        ll = new LatLon(46.0 + 57.0 / 60 + 3.89813884505 / 3600, 7.0 + 26.0 / 60 + 19.076595154147 / 3600);
     
    117119        assertTrue("Berne", Math.abs(en.north() - 200000.0) < 0.1);
    118120
    119         ll = new LatLon(46.0 + 2.0 / 60 + 38.87 / 3600, 8.0 + 43.0 / 60 + 49.79 / 3600);
     121        // http://geodesy.geo.admin.ch/reframe/lv03towgs84?easting=700000&northing=100000
     122        ll = new LatLon(46.04412093223244, 8.730497366167727);
    120123        en = Main.getProjection().latlon2eastNorth(ll);
    121124        if (debug) {
     
    128131    @Test
    129132    public void testBeastNorth2latlon() {
    130         EastNorth en = new EastNorth(533111.69, 152227.85);
     133        EastNorth en = new EastNorth(533112.13, 152227.35);
    131134        LatLon ll = Main.getProjection().eastNorth2latlon(en);
    132135        if (debug) {
     
    136139        assertTrue("Lausanne", Math.abs(ll.lon() - 6.567) < 0.00001);
    137140
    138         en = new EastNorth(685544.16, 292782.91);
     141        en = new EastNorth(685542.97, 292783.21);
    139142        ll = Main.getProjection().eastNorth2latlon(en);
    140143        if (debug) {
     
    144147        assertTrue("Schafouse", Math.abs(ll.lon() - 8.58) < 0.00001);
    145148
    146         en = new EastNorth(833068.04, 163265.39);
     149        en = new EastNorth(833066.95, 163265.32);
    147150        ll = Main.getProjection().eastNorth2latlon(en);
    148151        if (debug) {
     
    160163        assertTrue("Berne", Math.abs(ll.lon() - (7.0 + 26.0 / 60 + 19.076595154147 / 3600)) < 0.00001);
    161164
     165        // http://geodesy.geo.admin.ch/reframe/lv03towgs84?easting=700000&northing=100000
    162166        en = new EastNorth(700000.0, 100000.0);
    163167        ll = Main.getProjection().eastNorth2latlon(en);
     
    165169            System.out.println(ll);
    166170        }
    167         assertTrue("Ref", Math.abs(ll.lat() - (46.0 + 2.0 / 60 + 38.87 / 3600)) < 0.00001);
    168         assertTrue("Ref", Math.abs(ll.lon() - (8.0 + 43.0 / 60 + 49.79 / 3600)) < 0.00001);
     171        assertTrue("Ref", Math.abs(ll.lat() - 46.04412093223244) < 0.00001);
     172        assertTrue("Ref", Math.abs(ll.lon() - 8.730497366167727) < 0.00001);
    169173    }
    170174
Note: See TracChangeset for help on using the changeset viewer.