如何在C ++中阅读GeoTiff文件 [英] How to read the GeoTiff file in C++

查看:134
本文介绍了如何在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();
} 

推荐答案

在Google上找到一些样本并不是那么难。它看起来像中央的 Geotiff 网站,它有一些样本。



看起来他们也有一个不错的示例服务器。在深入了解该代码后,您应该适合。



在自述站中:如果您有其他样品,您想提交到此档案

请通过warmerda@home.com(或warmerda@remotesensing.org)与我联系。
It shouldnt be so hard to find some samples with Google. It looks like the central Geotiff site, which has some sample.

Looks like they have a also nice sample server. After digging through that code you should be fit.

In the readme stands: "If you have additional samples you would like to submit to this archive
please contact me at warmerda@home.com (or warmerda@remotesensing.org)."


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆