Skip to main content

Geotiff without geotools

3 replies [Last post]
sportinguista
Offline
Joined: 2010-05-30

Hi,

I am currently working with multiband TIFF images, which include geotiff metadata. My objetive is to read some tags whith relevant info like: DATUM, projection, coordinates, resolution, zone... in order to georreference my images.

So: Can I find all these data using this code?

http://johnbokma.com/java/obtaining-image-metadata.html

At the same time, I have loaded my image in "libgeoGUI" application to see geotiff info. Comparing it´s output with the java application output, I can´t see the same info: for example:

GeogLinearUnitsGeoKey (Short,1): Linear_Meter
GeogAngularUnitsGeoKey (Short,1): Angular_Degree
ProjectedCSTypeGeoKey (Short,1): PCS_WGS84_UTM_zone_19S

-> this is just what I need from my java applicaton. How can I obtain that has UTM projection, distance in meters, and angular degree?

LIBGEOGUI OUTPUT
**************************

Geotiff_Information:
Version: 1
Key_Revision: 1.0
Tagged_Information:
ModelTiepointTag (2,3):
0 0 0
310095 6400585 0
ModelPixelScaleTag (1,3):
30 30 0
End_Of_Tags.
Keyed_Information:
GTModelTypeGeoKey (Short,1): ModelTypeProjected
GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
GeogLinearUnitsGeoKey (Short,1): Linear_Meter
GeogAngularUnitsGeoKey (Short,1): Angular_Degree
ProjectedCSTypeGeoKey (Short,1): PCS_WGS84_UTM_zone_19S
End_Of_Keys.
End_Of_Geotiff.

PCS = 32719 (name unknown)
Projection = 16119 ()
Projection Method: CT_TransverseMercator
ProjNatOriginLatGeoKey: 0.000000 ( 0d 0' 0.00"N)
ProjNatOriginLongGeoKey: -69.000000 ( 69d 0' 0.00"W)
ProjScaleAtNatOriginGeoKey: 0.999600
ProjFalseEastingGeoKey: 500000.000000 m
ProjFalseNorthingGeoKey: 10000000.000000 m
GCS: 4326/WGS 84
Datum: 6326/World Geodetic System 1984
Ellipsoid: 7030/WGS 84 (6378137.00,6356752.31)
Prime Meridian: 8901/Greenwich (0.000000/ 0d 0' 0.00"E)
Corner Coordinates:
Upper Left ( 310095.000, 6400585.000)
Lower Left ( 310095.000, 6301825.000)
Upper Right ( 364785.000, 6400585.000)
Lower Right ( 364785.000, 6301825.000)
Center ( 337440.000, 6351205.000)

Java metadata reader output:
*********************************

Format name: com_sun_media_imageio_plugins_tiff_image_1.0

...........................................

..........................

Format name: javax_imageio_1.0

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
marcojacob
Offline
Joined: 2006-07-10

Hi,

I did google research for the first answer because I am interested
in extending my knowledge. Now it is up to you to do some research.
As I mentioned above:

"There are several implementation of wrapping MetaInfo classes
to parse the tag values in the web. Try google."

You can google and find some additional classes. e.g. you can
get wrapper classes to the MetaInfo that can give the textual
representation. These functionality is not part of imageio or
ja-imageio. That is what I saw doing a short google request.

marcojacob
Offline
Joined: 2006-07-10

The information is already there:

GeoKeyDirectory, GeoAsciiParams

ImageIO does not provide a class to analyse this values.
There are several implementation of wrapping MetaInfo classes
to parse the tag values in the web. Try google.

e.g. the GeoKeyDirectory is organized in rows of 4 values.
I can read from your output below:

1, 1, 0, 5 // 1 = info tag, revision 1.0, 5 further keys
1024, 0, 1, 1 // 1024 = GTModelTypeGeoKey value=1 (ModelTypeProjected)
1025, 0, 1, 1 // 1025 = GTRasterTypeGeoKey value=1 (RasterPixelIsArea)
2052, 0, 1, 9001 // 2052 = GeogLinearUnitsGeoKey value=9001 (Linear_Meter)
2054, 0, 1, 9102 // 2054 = GeogAngularUnitsGeoKey value=9102 (Angular_Arc_Second)
3072, 0, 1, 32719 // 3072 = ProjectedCSTypeGeoKey value=32719 (PCS_WGS84_UTM_zone_19S)

References I found for reading:
http://www.remotesensing.org/geotiff/spec/geotiff2.4.html#2.4
http://www.remotesensing.org/geotiff/spec/geotiff2.7.html#2.7

Kind regards,
Marco

sportinguista
Offline
Joined: 2010-05-30

Hi Marco, thanks for reply.

How could I generate a data description of my geotiff metadata instead of showing numbers?

That is to say, I prefer to show "PCS_WGS84_UTM_zone_19S", "Linear_Meter"... instead of "32719" or ..."9001"

There must be a class in Java to make this mapping: please could you tell me which?

Thank you!