的座標,我得到的GeoTIFF元數據與GeoTiffIIOMetadataAdapter類:得到TIFF文件
String filename = pathToMyTiffFile;
FileImageInputStream f = new FileImageInputStream(
new RandomAccessFile(filename, "r"));
// Look through ImageIO readers
Iterator iter = ImageIO.getImageReaders(f);
IIOMetadata imdata = null;
GeoTiffIIOMetadataAdapter geo_data;
while (iter.hasNext() && imdata == null) {
ImageReader reader = (ImageReader) iter.next();
reader.setInput(f, true);
String reader_name = reader.getFormatName().toLowerCase();
if (reader_name.equalsIgnoreCase("tif")) {
// Get Image metadata
imdata = reader.getImageMetadata(0);
geo_data = new GeoTiffIIOMetadataAdapter(imdata);
if (geo_data != null &&
geo_data.getGeoKeyDirectoryVersion() == 1) {
geo_data.getModelTiePoints(); //here i get [0.0,0.0,0.0,173084.9999999999,5845515.0,0.0]
}
}
}
我怎樣才能提取/這個數組轉換爲平時的緯度/經度座標?我對173084.9999999999,5845515.0是tiff文件的左上角座標嗎?
在此先感謝!
你需要知道的投射比變換從投影座標轉換成經/緯度 – Thomas