/
compile_gdal.sh
executable file
·48 lines (40 loc) · 1.01 KB
/
compile_gdal.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -e;
export LC_ALL=en_US.UTF-8;
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib;
export DEBIAN_FRONTEND=noninteractive;
# location of this file in filesystem
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd );
# install the latest version of gdal
# remove version provided by package manager
# sudo apt-get -qq remove -y "gdal-bin";
# clean up
rm -rf $DIR/tmp;
mkdir -p $DIR/tmp;
# download and extract source code
SOURCE="http://download.osgeo.org/gdal/2.2.3/gdal-2.2.3.tar.gz";
wget -q $SOURCE -P $DIR/tmp;
cd $DIR/tmp;
tar xvfz $(basename "$SOURCE");
# compile source
cd $(basename "$SOURCE" ".tar.gz");
./configure \
--with-proj=/usr/local/lib \
--with-threads=yes \
--with-libtiff=internal \
--with-geotiff=internal \
--with-jpeg=internal \
--with-gif=internal \
--with-png=internal \
--with-sqlite3=yes \
--with-spatialite=yes \
--with-geos=yes \
--with-libz=internal;
make -j8;
# install
sudo make install;
sudo ldconfig;
cd -;
# echo new version
cd -
ogr2ogr --version;