本文介绍了如何在C ++中阅读GeoTiff文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

引用:

最近大家好我正在尝试阅读GeoTiff文件,但我找不到一个好的例子如果你们都知道这请和

Hello everyone recently I am trying to read the GeoTiff file, but I could not find a good example If you guys know about this please and

引用:

下面是我的代码我做了什么

below is my code I did something

帮我谢谢




#include <QtCore/QCoreApplication>
#include <qstring.h>
#include <xtiffio.h>
#include <geotiff.h>
#include <geotiffio.h>
#include <tiff.h>
#include <tiffio.h>

enum {VERSION=0,MAJOR,MINOR};

int main(int argc, char *argv[])
{
	QCoreApplication a(argc, argv);
	
	const char* fileName = "Data_Bin_Geo.tif";
	int versions[3]; 
	int cit_length;
	int  size;
	tagtype_t type;
	 char *citation;

	TIFF *tif=(TIFF*)0; 
    GTIF *gtif=(GTIF*)0; 

	tif = XTIFFOpen( fileName, "r" );

	gtif = GTIFNew( tif );

	//GTIFDirectoryInfo( gtif, versions, 0 );

	cit_length = GTIFKeyInfo( gtif, GTCitationGeoKey, &size, &type );

	if (cit_length > 0)
	{
		citation == malloc( size*cit_length );

		GTIFKeyGet(gtif, GTCitationGeoKey, citation, 0, cit_length);

		printf("Citation:%s\n",citation);
	}

	        return a.exec();
} 

推荐答案


这篇关于如何在C ++中阅读GeoTiff文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 10:50