Install and use the Python version of gdal

Source: Internet
Author: User

First, compile the Python version of gdal. For details about the compilation, refer to the previous blog gdal's swig compilation. The URL is http://blog.csdn.net/liminlu0314/article/details/6945452. Or download the compiled version.

Copy all downloaded files to the Lib \ Site-packages folder under the python installation directory, as shown in:

Then, open Python and enter:

Import osgeo. gdal

Press enter. If an error is displayed, the installation is successful. If no, the installation is successful. A piece of test code:

From osgeo import gdalfrom osgeo. gdalconst import * dataset = gdal. open ("F: \ work \ data \ envi. IMG ", ga_readonly) dataset. getdriver (). shortname # 'envi' # image format dataset. getprojectionref () # 'projcs ["unnamed", geogcs ["nad83", datum ["north_american_datum_1983", spheroid ["GRs 1980", 6378137,298.257222101, authority ["epsg ", "7019"], towgs84 [0, 0, 0, 0, 0], authority ["epsg", "6269"], primem ["Greenwich", 0, authority ["epsg", "8901"], Unit ["degree", 0.0174532925199433, authority ["epsg", "9108"], authority ["epsg ", "4269"], projection ["transverse_mercator"], parameter ["latitude_of_origin", 30], parameter ["central_meridian",-84.16666666666667], parameter ["scale_factor ", 0.9999], parameter ["false_easting", 2296587.926509186], parameter ["false_northing", 0], Unit ["foot (international)", 0.3048] '# image projection Information

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.