1
13693261870
2024-11-14 3aea0bf8e9f3178fe2aabb1e546de584d2bd5fcf
src/main/java/com/se/simu/helper/GdalHelper.java
@@ -128,8 +128,7 @@
        }
    }
    public static Geometry getMinPoint(Dataset ds)
    {
    public static Geometry getMinPoint(Dataset ds) {
        double[] transform = new double[6];
        ds.GetGeoTransform(transform);
@@ -142,8 +141,7 @@
        return Transform(ds, point);
    }
    public static Geometry getMaxPoint(Dataset ds)
    {
    public static Geometry getMaxPoint(Dataset ds) {
        double[] transform = new double[6];
        ds.GetGeoTransform(transform);
@@ -156,11 +154,9 @@
        return Transform(ds, point);
    }
    public static Geometry Transform(Dataset ds, Geometry point)
    {
    public static Geometry Transform(Dataset ds, Geometry point) {
        point.AssignSpatialReference(ds.GetSpatialRef());
        if (ds.GetSpatialRef().IsGeographic() > 0)
        {
        if (ds.GetSpatialRef().IsGeographic() > 0) {
            return point;
        }
@@ -189,6 +185,15 @@
        return point;
    }
    public static int toWgs84(SpatialReference sr, Geometry g) {
        CoordinateTransformation ct = new CoordinateTransformation(sr, GdalHelper.SR4326);
        if (sr.IsProjected() != 1) {
            sr.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER);
        }
        return g.TransformTo(GdalHelper.SR4326);
    }
    public static double[] fromWgs84(SpatialReference sr, double x, double y) {
        CoordinateTransformation ct = new CoordinateTransformation(GdalHelper.SR4326, sr);
        if (sr.IsProjected() != 1) {