| | |
| | | } |
| | | } |
| | | |
| | | public static Geometry getMinPoint(Dataset ds) |
| | | { |
| | | public static Geometry getMinPoint(Dataset ds) { |
| | | double[] transform = new double[6]; |
| | | ds.GetGeoTransform(transform); |
| | | |
| | |
| | | return Transform(ds, point); |
| | | } |
| | | |
| | | public static Geometry getMaxPoint(Dataset ds) |
| | | { |
| | | public static Geometry getMaxPoint(Dataset ds) { |
| | | double[] transform = new double[6]; |
| | | ds.GetGeoTransform(transform); |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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) { |