orbisgis / cts

Projection library in Java
GNU Lesser General Public License v3.0
49 stars 15 forks source link

Add OSGB36 NTv2 grid #127

Open ebocher opened 4 years ago

ebocher commented 4 years ago

See this discussion : https://github.com/orbisgis/cts/pull/125

Thanks a lot to @mukoki

ebocher commented 3 years ago

Related to https://github.com/dbeaver/dbeaver/issues/8553

Unit test

@Test
    void testEPSGCodeFrom4326To2232() throws Exception {
        String csNameSrc = "EPSG:4326"; //Input EPSG
        double[] pointSource = new double[]{-105,40};
        String csNameDest = "EPSG:2232";  //Target EPSG 
        double[] pointDest = new double[]{3140089.069 , 1789525.0783};
        double tolerance = 0.001;
        CoordinateReferenceSystem inputCRS = cRSFactory.getCRS(csNameSrc);
        CoordinateReferenceSystem outputCRS = cRSFactory.getCRS(csNameDest);
        verbose = true;
        double[] result = transform((GeodeticCRS) inputCRS, (GeodeticCRS) outputCRS, pointSource);
        assertTrue(checkEquals2D("EPSG:4326 to EPSG:2232", result, pointDest, tolerance));
    }
ebocher commented 3 years ago

As @mukoki already suggest we can reuse the files provided by proj lib So we must read this file and populate the CTS grid transform

NADCON transformations use two grid files, one for a latitude shift and one for a longitude shift, that end in .las and .los extensions. NADCON 5 transformations use at least two files, for GridLat and GridLon, and also may optionally use a third file, for GridHeight.

mukoki commented 3 years ago

This should not be very different from the NTv2 case. There is still some work to do : get the format specification, write the parser, implement a new GridBasedTransformation, tests... Not easy to find the time, but not too much challenging from a technical point of view. I know that if we dig into this stuff, we'll discover many versions and possible confusions between grids, realization dates... Hopefully, we can take inspiration in proj4 or other more matures libraries

ebocher commented 3 years ago

Thanks a lot. I'll add it to the 1.7 road map And sure we can inspiration in proj4.