Installation and use of GDAL in Python under Ubuntu

Use the gdal provided by ubuntugis for installation.
First update the source of ubuntugis:

sudo add-apt-repository ppa:ubuntugis && sudo apt-get update

or

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable && sudo apt-get update

Here is a popular science PPA (taken from Baidu Encyclopedia):
Personal Package Archives (Personal Package Archives) is a service provided by the Ubuntu Launchpad website, which allows individual users to upload software source code, compile it through Launchpad and publish it as a binary package, as an apt/Synaptic source for other users Download and update. Every user and team on the Launchpad website can have one or more PPAs.

Then install the C++ version of GDAL:

sudo apt-get install gdal-bin

Then install GDAL's Python Wrapper package:

sudo pip install gdal

Use Eclipse+PyDev for development under Ubuntu.
See a small program:

from osgeo import gdal

file_path ='/home/theone/Data/GreatKhingan/DEM/Slope_GreatKhingan_500m.tif'
dataset = gdal.Open(file_path)print(type(dataset))

metadata = dataset.GetMetadata()print(metadata)

projection = dataset.GetProjection()print(projection)

operation result:

< class'osgeo.gdal.Dataset'>{'TIFFTAG_XRESOLUTION':'1','TIFFTAG_YRESOLUTION':'1','AREA_OR_POINT':'Area'}<type 'str'>
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]]

Recommended Posts

Installation and use of GDAL in Python under Ubuntu
Installation and use of SSH in Ubuntu environment
Installation and use of Mysql under CentOS
Installation and uninstallation of CUDA under Ubuntu 16.04
Installation and deployment of Nginx in Ubuntu
Installation and use of Win10 subsystem Ubuntu
[python] python2 and python3 under ubuntu
Detailed explanation of the installation and use of SSH in the Ubuntu environment
Installation of pulseaudio and API usage under Ubuntu 12.04
Installation, configuration and uninstallation of GitLab in Ubuntu19.1
Use of Anaconda in Ubuntu
Use of mediawiki under ubuntu
Installation and simple practice of MySQL in ubuntu environment (1)
Installation and usage instructions of rz/sz command under ubuntu
Happy installation of Jenkins in ubuntu
Installation of deb package under Ubuntu
Use of numpy in Python development
Redis installation under ubuntu and windows
Installation of Docker CE under Ubuntu
Coexistence of CUDA8.0 and CUDA9.0 under Ubuntu 16.04
ubuntu Docker installation and deployment of Rancher
Installation of python common libraries under windows
Common exceptions and solutions in the use and development of Ubuntu system
Detailed explanation of quick installation and configuration of Subversion (SVN) under Ubuntu
How to use and and or in Python
Installation and configuration of redis under centos7
Ubuntu18.04 Server version installation and use (graphic)
KVM installation and preliminary use under CentOS 7.2
Ubuntu basic settings: introduction to the installation and use of openssh-server
DLNA/UPnP Server installation and configuration under Ubuntu 12.04
Detailed explanation of the use of pip in Python | summary of third-party library installation
Installation and configuration of JDK in CentOS 7 system
Summary of methods to use Evernote under Ubuntu 14.04
The meaning and usage of lists in python
Use Ubuntu and windows system in virtual machine
Problems encountered in pip tool installation under Ubuntu
Installation and configuration of rsync server under CentOS 6.5
Kaldi installation and configuration graphic tutorials under Ubuntu
The consequences of uninstalling python in ubuntu, very
Installation and configuration of CentOS 7 in VMware Workstation
Introduction to the use of Hanlp in ubuntu
Install python3.6 under Ubuntu 16.04
Python MySQLd under Ubuntu
Use supervisor in ubuntu
Ubuntu introduction and installation
Use iptables under ubuntu
LNMP installation under Ubuntu
Install python in Ubuntu
Installation and cracking of confluence6.3 operation records under Centos
Ubuntu16.04 mirror complete installation and configuration tutorial under VMware
Cpp web (1) Install and use Crow service under Ubuntu
Python introduction and environment installation
ubuntu18.04 compile and install python3.8
ubuntu view python installation path
Ubuntu16.04 installation and simple configuration
Use sublime tex under ubuntu
GitLab installation and basic use
centos7 kvm installation and use
CentOS7 postgresql installation and use
Python version of OpenCV installation
Generators and iterators in Python