PROJ4J转换空间坐标

1.大地坐标转经纬度坐标:以WGS84为例:

XYZ转BLH:

       ProjCoordinate projCoordinateXYZConvertBLH = new ProjCoordinate(X, Y, Z);
        GeocentricConverter geocentricConverter = new GeocentricConverter(WGS84);
        geocentricConverter.convertGeocentricToGeodetic(projCoordinateXYZConvertBLH);
        double b = projCoordinateXYZConvertBLH.x, l = projCoordinateXYZConvertBLH.y,h=projCoordinateXYZConvertBLH.z;
        //将弧度转经纬度
        System.out.println(Math.toDegrees(b), Math.toDegrees(l), h);

2.经纬度坐标转大地坐标:以WGS84为例:

BLH转XYZ:

        ProjCoordinate projCoordinateBLHtoXYZ = new ProjCoordinate(b, l, h);
        GeocentricConverter geocentricConverterBLHtoXYZ = new GeocentricConverter(WGS84);
        geocentricConverterBLHtoXYZ.convertGeodeticToGeocentric(projCoordinateBLHtoXYZ);
        double x = projCoordinateXYZConvertBLH.x, y = projCoordinateXYZConvertBLH.y,z=projCoordinateXYZConvertBLH.z;
       System.out.println(x,y,z)

你可能感兴趣的:(PROJ4J转换空间坐标)