MCPcopy Create free account
hub / github.com/OSGeo/gdal / GDALInfoReportCorner

Method GDALInfoReportCorner

swig/java/apps/gdalinfo.java:589–660  ·  view source on GitHub ↗
(Dataset hDataset, String corner_name,
			double x, double y)

Source from the content-addressed store, hash-verified

587 /************************************************************************/
588
589 static boolean GDALInfoReportCorner(Dataset hDataset, String corner_name,
590 double x, double y)
591
592 {
593 double dfGeoX, dfGeoY;
594 String pszProjection;
595 double[] adfGeoTransform = new double[6];
596 CoordinateTransformation hTransform = null;
597
598 System.out.print(corner_name + " ");
599
600 /* -------------------------------------------------------------------- */
601 /* Transform the point into georeferenced coordinates. */
602 /* -------------------------------------------------------------------- */
603 hDataset.GetGeoTransform(adfGeoTransform);
604 {
605 pszProjection = hDataset.GetProjectionRef();
606
607 dfGeoX = adfGeoTransform[0] + adfGeoTransform[1] * x
608 + adfGeoTransform[2] * y;
609 dfGeoY = adfGeoTransform[3] + adfGeoTransform[4] * x
610 + adfGeoTransform[5] * y;
611 }
612
613 if (adfGeoTransform[0] == 0 && adfGeoTransform[1] == 0
614 && adfGeoTransform[2] == 0 && adfGeoTransform[3] == 0
615 && adfGeoTransform[4] == 0 && adfGeoTransform[5] == 0) {
616 System.out.println("(" + x + "," + y + ")");
617 return false;
618 }
619
620 /* -------------------------------------------------------------------- */
621 /* Report the georeferenced coordinates. */
622 /* -------------------------------------------------------------------- */
623 System.out.print("(" + dfGeoX + "," + dfGeoY + ") ");
624
625 /* -------------------------------------------------------------------- */
626 /* Setup transformation to lat/long. */
627 /* -------------------------------------------------------------------- */
628 if (pszProjection != null && pszProjection.length() > 0) {
629 SpatialReference hProj, hLatLong = null;
630
631 hProj = new SpatialReference(pszProjection);
632 if (hProj != null)
633 hLatLong = hProj.CloneGeogCS();
634
635 if (hLatLong != null) {
636 hTransform = CoordinateTransformation.CreateCoordinateTransformation(hProj, hLatLong);
637 }
638
639 if (hProj != null)
640 hProj.delete();
641 }
642
643 /* -------------------------------------------------------------------- */
644 /* Transform to latlong and report. */
645 /* -------------------------------------------------------------------- */
646 if (hTransform != null) {

Callers 1

mainMethod · 0.95

Calls 6

lengthMethod · 0.95
CloneGeogCSMethod · 0.80
deleteMethod · 0.80
printMethod · 0.45
GetGeoTransformMethod · 0.45
GetProjectionRefMethod · 0.45

Tested by

no test coverage detected