1

My main goal is to achieve the same conversion as to the following command using geotools.

cs2cs -f "%.7f" +init=epsg:23700 +nadgrids=etrs2eov_notowgs.gsb +geoidgrids=geoid_eht2014.gtx +to +init=epsg:4258

Basically I would like to convert points from EOV to ETRS89 with high precision, so I would like to use correction grids.

So far I created the following java program:

public static void main(String... args) throws Exception {
    initialize();

    CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:23700");
    CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4258");
    MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS);
    checkTransform(transform);

    DirectPosition2D srcDirectPosition2D = new DirectPosition2D(sourceCRS, 650000, 180000);
    DirectPosition2D destDirectPosition2D = new DirectPosition2D(targetCRS);
    transform.transform(srcDirectPosition2D, destDirectPosition2D);
    System.out.println(destDirectPosition2D);
}

private static void checkTransform(MathTransform transform) throws Exception {
    if (!transform.toString().contains("NTv2")) {
        throw new Exception("Latitude and longitude difference file not loaded.");
    }
}

private static void initialize() {
    System.setProperty("org.geotools.referencing.forceXY", "true");
    ReferencingFactoryFinder.addAuthorityFactory(new WKTOperationFactory("transform_overrides.properties"));
}

My transform_overrides.properties looks the following:

4258,23700=PARAM_MT["NTv2", PARAMETER["Latitude and longitude difference file", "etrs2eov_notowgs.gsb"]]

These are the two files that are needed for the conversion:

http://www.agt.bme.hu/on_line/etrs2eov/etrs2eov_notowgs.gsb http://www.agt.bme.hu/on_line/etrs2eov/geoid_eht2014.gtx

My problem is that the source point (650000 180000) is not converted to the desired CRS (should be: 19.04745712900 46.96421283181).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.