Diagram vc++2012 compiling and installing GDAL1.11.0 and Getting started examples

Source: Internet
Author: User

Related Downloads

Http://pan.baidu.com/s/1o7OEMc6

Gdal1.rar-Getting Started example
Gdal book codes and data-rar
Gdal1110.zip-Download the source code
Gdal.rar-Content after a successful build

1 Enter the following directory to execute Vcvars32.bat


2 Switch to extract directory Execute command

nmake/f Makefile.vc, compile; time is longer; maybe 10 minutes;










Complete the compilation;

3. Set the output directory
Locate the nmake.opt file in the download directory, for example, the file path in this article is:
D:\gdal-1.11.0\nmake.opt
Open the Modify Gdal_home value for the installation directory. The directories used in this article are as follows:
Gdal_home = "D:\GDAL"
The D:\GDAL directory should be created manually first

4 Build

Switch to the unzip directory and execute it successively

nmake/f MAKEFILE.VC Install
nmake/f MAKEFILE.VC Devinstall




Build a successful content:




5 Introductory examples

Create a new console project, add the Include directory, library directory, additional dependencies, and copy the Gdal111.dll to the project;




Code

#include "stdafx.h" #include <gdal_priv.h> #include <iostream>using namespace std;int _tmain (int argc, _ tchar* argv[]) {Gdaldataset *podataset;  Data set object pointer  gdalallregister ();        Registered driver Podataset = (Gdaldataset *) gdalopen ("Mosaic.tif", ga_readonly); if (podataset! = NULL) {cout << "rasterxsize : "<< Podataset, Getrasterxsize () << endl;cout <<" rasterysize: "<< Podataset and Getraster Ysize () << endl;cout << "Rastercount:" << Podataset, Getrastercount () << Endl; Gdalclose ((Gdaldataseth) podataset);   } GetChar (); return 0;}


Operation effect;


Test data such as the TIF file used can be downloaded in the previous link.


RELATED links:

Http://malagis.com/win7-vs2010-gdal.html

Http://www.cnblogs.com/zhangjun1130/archive/2009/11/13/1602340.html



Diagram vc++2012 compiling and installing GDAL1.11.0 and Getting started examples

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.