Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMAGING-314-1 Logic improvement, print additional information #178

Merged
merged 1 commit into from
Oct 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ private static void summarizeGeoTiffTags(PrintStream ps, TiffDirectory directory
ps.format("%nContent Type: %s", contentTypeString);
String gdalNoDataString[] = directory.getFieldValue(
GdalLibraryTagConstants.EXIF_TAG_GDAL_NO_DATA, false);
if (gdalNoDataString != null || gdalNoDataString.length > 0) {
if (gdalNoDataString != null && gdalNoDataString.length > 0) {
ps.format(" GDAL No-Data value: %s", gdalNoDataString[0]);
}
ps.format("%n");
Expand Down Expand Up @@ -418,6 +418,63 @@ private static void summarizeGeoTiffTags(PrintStream ps, TiffDirectory directory
}
}

/**
* Provides specifications for Coordinate Transformation Codes as defined
* in Appendix 6.3.3.3 "Coordinate Transformation Codes" of the
* original GeoTiff specification (Ritter, 1995).
*/
enum CoordinateTransformationCode {
TransverseMercator( 1),
TransvMercator_Modified_Alaska( 2),
ObliqueMercator( 3),
ObliqueMercator_Laborde( 4),
ObliqueMercator_Rosenmund( 5),
ObliqueMercator_Spherical( 6),
Mercator( 7),
LambertConfConic_2SP( 8),
LambertConfConic_Helmert( 9),
LambertAzimEqualArea( 10),
AlbersEqualArea( 11),
AzimuthalEquidistant( 12),
EquidistantConic( 13),
Stereographic( 14),
PolarStereographic( 15),
ObliqueStereographic( 16),
Equirectangular( 17),
CassiniSoldner( 18),
Gnomonic( 19),
MillerCylindrical( 20),
Orthographic( 21),
Polyconic( 22),
Robinson( 23),
Sinusoidal( 24),
VanDerGrinten( 25),
NewZealandMapGrid( 26),
TransvMercator_SouthOriented( 27);

int key;

CoordinateTransformationCode(int key){
this.key = key;
}

/**
* Gets the enumeration value associated with the specified
* key if any.
* @param key a positive integer
* @return if the key is matched, a value enumeration value;
* otherwise, a null.
*/
static CoordinateTransformationCode getValueForKey(int key){
for(CoordinateTransformationCode v: values()){
if(v.key==key){
return v;
}
}
return null;
}
}

/**
* Interprets elements from one row of the GeoKey table, returning a
* descriptive string where possible. The GeoTIFF specification is
Expand Down Expand Up @@ -500,6 +557,18 @@ private static String interpretElements(
return "User-Defined Projection";
}
break;
case ProjectionGeoKey:
if(valueOrPosition==32767){
return "User-Defined";
}
break;
case ProjCoordTransGeoKey:
CoordinateTransformationCode code =
CoordinateTransformationCode.getValueForKey(valueOrPosition);
if(code!=null){
return code.name();
}
break;
case ProjLinearUnitsGeoKey:
switch (valueOrPosition) {
case 9001:
Expand All @@ -511,6 +580,20 @@ private static String interpretElements(
default:
break;
}
break;
case ProjStdParallel1GeoKey:
case ProjStdParallel2GeoKey:
case ProjNatOriginLongGeoKey:
case ProjFalseEastingGeoKey:
case ProjFalseNorthingGeoKey:
case ProjFalseOriginLongGeoKey:
case ProjFalseOriginLatGeoKey:
case ProjFalseOriginEastingGeoKey:
case ProjFalseOriginNorthingGeoKey:
case ProjCenterLongGeoKey:
case ProjCenterLatGeoKey:
return String.format("%13.4f", doubleParameters[valueOrPosition]);

default:
break;
}
Expand Down