当前位置:   article > 正文

Linux(CentOS)编译安装GDAL3.0.4+Postgresql 12.2+Postgis-3.0.1_postgis 下载 linux 安装tar,gz

postgis 下载 linux 安装tar,gz

    有需要GDAL开发的同学,在linux服务器上,最好还是自己编译环境,初次编译是很痛苦,但是在此过程中,对插件之间的版本依赖关系,插件编译配置、问题定位,解决问题,shell脚本都能够全面的提升。最后还能得到一个最新版的环境,何乐而不为了!!!

一、环境准备

1、环境要求

Centos系统可以访问外网。

Centos系统版本:CentOS Linux release 7.3.1611 (Core)

需要安装的软件如下:

apache-ant-1.10.12-bin.tar.gz
cgal-4.14.tar.xz
cmake-3.20.6.tar.gz
gdal-3.0.4.tar.gz
geos-3.8.0.tar.bz2
gmp-6.1.2.tar.bz2
json-c-json-c-0.13.1-20180305.tar.gz
libxml2-2.9.10.tar.gz
mpfr-4.0.2.tar.gz
pcre-8.44.tar.gz
postgis-3.0.1.tar.gz
postgresql-12.2.tar.gz
proj-6.3.1.tar.gz
protobuf-c-1.3.3.tar.gz
protobuf-cpp-3.11.4.tar.gz
SFCGAL-1.3.7.tar.gz
sqlite-autoconf-3360000.tar.gz
swig-4.0.1.tar.gz

2、环境安装

先通过yum基础插件

yum -y install gcc gcc-c++ gcc-g77 make libtool flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel openssl-devel libxml2-devel gettext-devel pcre-devel

二、编译Postgresql-12.2

以下所有安装源文件放置均放在/usr/local/src/

1、安装postgresql数据库

复制代码
  1. #用户组
  2. groupadd postgres
  3. #用户组添加用户
  4. useradd -g postgres postgres
  5. mkdir -p /usr/local/pgsql
  6. mkdir /usr/local/pgsql/data
  7. chown -R postgres:postgres /usr/local/pgsql
  8. cd /usr/local/src/
  9. wget https://ftp.postgresql.org/pub/source/v12.2/postgresql-12.2.tar.gz
  10. tar -xzvf postgresql-12.2.tar.gz
  11. cd postgresql-12.2
  12. ./configure --prefix=/usr/local/pgsql --without-readline
  13. make && make install

复制代码

./configure --prefix=/usr/local/pgsql --without-readline,效果:

image

make 效果:

image

make install 效果:

image

2、添加环境变量

vi打开配置文件后,按i插入,ESC退出编译,:wq保存,:q!不保存,以后每次保存后要刷新环境变量:source /etc/profile

复制代码

  1. vi /etc/profile
  2. PG_HOME=/usr/local/pgsql
  3. LD_LIBRARY_PATH=$PG_HOME/lib:$LD_LIBRARY_PATH
  4. PATH=$PG_HOME/bin:$PATH
  5. PKG_CONFIG_PATH=$PG_HOME/lib/pkgconfig:$PKG_CONFIG_PATH
  6. export PKG_CONFIG_PATH LD_LIBRARY_PATH
  7. source /etc/profile

复制代码

  1. 查看Postgresql版本命令
  2. pg_config --version

3、初始化数据库

  1. #切换用户
  2. su postgres
  3. #初始化数据库
  4. /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

4、设置远程可访问数据库

  1. #切换root
  2. exit
  3. vi /usr/local/pgsql/data/postgresql.conf
  4. listen_address = '*'
  5. port = 5432
  1. vi /usr/local/pgsql/data/pg_hba.conf
  2. host all all 0.0.0.0/0 md5
  3. host all all 192.168.1.0/24 md5
  4. host all all ::1/128 ident

5、数据库服务

  1. #切换用户
  2. su postgres
  3. #启动数据库服务器
  4. /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

image

复制代码
  1. #创建数据库
  2. /usr/local/pgsql/bin/createdb gisdb
  3. #停止数据库服务
  4. /usr/local/pgsql/bin/pg_ctl stop -D /usr/local/pgsql/data
  5. #重新启动数据库
  6. /usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data

复制代码

到这里,数据库已经安装成功了,使用navicat或dbeaver连接试试吧!

操作命令说明
  1. pg_ctl stop -D /usr/local/pgsql/data/
  2. pg_ctl start -D /usr/local/pgsql/data/
  3. pg_ctl restart -D /usr/local/pgsql/data/

6、设置Postgresql自启动

/usr/lib/systemd/system 新建postgresql.service文件,复制以下内容到postgresql.service

复制代码

  1. [Unit]
  2. Description=PostgreSQL database server
  3. After=network.target
  4. [Service]
  5. Type=forking
  6. User=postgres
  7. Group=postgres
  8. # Port number for server to listen on
  9. Environment=PGPORT=5432
  10. # Location of database directory
  11. Environment=PGDATA=/usr/local/pgsql/data
  12. # Where to send early-startup messages from the server (before the logging
  13. # options of postgresql.conf take effect)
  14. # This is normally controlled by the global default set by systemd
  15. # StandardOutput=syslog
  16. # Disable OOM kill on the postmaster
  17. OOMScoreAdjust=-1000
  18. #ExecStartPre=/usr/local/pgsql/bin/postgresql-check-db-dir ${PGDATA}
  19. ExecStart=/usr/local/pgsql/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300
  20. ExecStop=/usr/local/pgsql/bin/pg_ctl stop -D ${PGDATA} -s -m fast
  21. ExecReload=/usr/local/pgsql/bin/pg_ctl reload -D ${PGDATA} -s
  22. # Give a reasonable amount of time for the server to start up/shut down
  23. TimeoutSec=300
  24. [Install]
  25. WantedBy=multi-user.target
复制代码
  1. su root
  2. cd /usr/lib/systemd/system
  3. chmod 754 postgresql.service
  4. systemctl enable postgresql.service

7、其它一些操作命令说明

启动,停止,重启

  1. systemctl start postgresql.service
  2. systemctl stop postgresql.service
  3. systemctl restart postgresql.service

修改数据库密码

  1. su - postgres
  2. psql -U postgres
  3. ALTER USER postgres WITH PASSWORD '123456'
  4. \q

三、编译GDAL依赖

CentOs7安装unzip

yum install -y unzip zip

1、安装 sqlite3

复制代码
 
    

wget https://www.sqlite.org/2020/sqlite-autoconf-3360000.tar.gz tar –zxvf sqlite-autoconf-3360000.tar.gz cd sqlite-autoconf-3360000 bash ./configure --prefix=/usr/local/pgsql/plugin/sqlite3 make && make install

#软连接到/usr/bin目录

ln -s /usr/local/pgsql/plugin/sqlite3/bin/sqlite3 /usr/bin/sqlite3 echo "/usr/local/pgsql/plugin/sqlite3/lib" > /etc/ld.so.conf.d/sqlite3.conf ldconfig

#查看版本号

sqlite3 -version

复制代码
bash ./configure --prefix=/usr/local/pgsql/plugin/sqlite3 命令结果:

image

make 命令结果:

image

make install 命令结果:

image

2、安装 json-c-0.13.1

复制代码

  1. wget https://github.com/json-c/json-c/archive/json-c-0.13.1-20180305.tar.gz
  2. tar -xzvf json-c-0.13.1-20180305.tar.gz
  3. cd json-c-json-c-0.13.1-20180305
  4. bash ./configure --prefix=/usr/local/pgsql/plugin/json-c
  5. make && make install
  6. echo "/usr/local/pgsql/plugin/json-c/lib" > /etc/ld.so.conf.d/json-c-0.13.1.conf
  7. ldconfig

复制代码

bash ./configure --prefix=/usr/local/pgsql/plugin/json-c,命令效果:

image

make 命令效果:

image

make install 命令效果:

image

3、编译 protobuf-3.11.4,protobuf-c 1.3.3

  • 编译protobuf-3.11.4

  1. wget https://github.com/protocolbuffers/protobuf/releases/download/v3.11.4/protobuf-cpp-3.11.4.tar.gz
  2. tar -xzvf protobuf-cpp-3.11.4.tar.gz
  3. cd protobuf-3.11.4
  4. bash ./configure
  5. make && make install
  1. bash ./configure 命令效果:
  2. bash ./configure 命令效果:

make 命令效果:

image

make install 命令效果:

image

  • 编译protobuf-c 1.3.3

  1. wget https://github.com/protobuf-c/protobuf-c/releases/download/v1.3.3/protobuf-c-1.3.3.tar.gz
  2. tar -xzvf protobuf-c-1.3.3.tar.gz
  3. cd protobuf-c-1.3.3
  4. bash ./configure
  5. make && make install

bash ./configure 报错:

image

vi /etc/profile 添加配置

  1. PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
  2. export PKG_CONFIG_PATH

source /etc/profile 配置生效。

.configure 命令正常效果:

image

make 命令效果:

image

make install 命令效果:

image

4、安装Proj 6.3.1

复制代码
  1. wget https://download.osgeo.org/proj/proj-6.3.1.tar.gz
  2. tar -xf proj-6.3.1.tar.gz
  3. cd proj-6.3.1
  4. ./configure --prefix=/usr/local/pgsql/plugin/proj
  5. make && make install
  6. echo "/usr/local/pgsql/plugin/proj/lib" > /etc/ld.so.conf.d/proj-6.3.1.conf
  7. ldconfig
复制代码

./configure --prefix=/usr/local/pgsql/plugin/proj 命令报错,提示sqlite3版本太低,必须大于等于3.11,当前版本为3.7.17

image

解决方法:升级sqlite版本。如果再出现以下提示,应该是在安装sqlite3时指定了安装目录,个别命令没有安装全面。

image

重新安装sqlite3

复制代码
  1. wget https://www.sqlite.org/2020/sqlite-autoconf-3360000.tar.gz
  2. tar –zxvf sqlite-autoconf-3360000.tar.gz
  3. cd sqlite-autoconf-3360000
  4. ./configure --prefix=/usr/local/pgsql/plugin/sqlite3
  5. make && make install
  6. #查看版本号
  7. sqlite3 -version

复制代码

进入 /usr/local/src/proj-6.3.1目录, ./configure --prefix=/usr/local/pgsql/plugin/proj 命令正常效果:

image

make 命令效果:

image

make install 命令效果:

image

5、安装GEOS 3.8.0

复制代码

  1. wget http://download.osgeo.org/geos/geos-3.8.0.tar.bz2
  2. tar -jxf geos-3.8.0.tar.bz2
  3. cd geos-3.8.0
  4. ./configure --prefix=/usr/local/pgsql/plugin/geos
  5. make && make install
  6. echo "/usr/local/pgsql/plugin/geos/lib" > /etc/ld.so.conf.d/geos-3.8.0.conf
  7. ldconfig

复制代码

在解压 *.tar.bz2文件时报错如下,解决方法:yum -y install bzip2

image

./configure --prefix=/usr/local/pgsql/plugin/geos 命令效果:

image

make 命令效果:

image

make install 命令效果:

image

6、安装SFCGAL 1.3.7

由于SFCGAL需要依赖Boost、CGAL、GMP、MPFR这四个软件,所以具体总共需要安装以下四个软件:
boost-devel.x86_64
gmp-devel.x86_64
mpfr-devel.x86_64
CGAL-4.14

6.1 Boost-1.5.3

yum install boost boost-devel

6.2 GMP-6.1.2

  1. wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2
  2. tar -jxvf gmp-6.1.2.tar.bz2
  3. cd gmp-6.1.2
  4. bash ./configure --enable-cxx
  5. make && make install

./configure --enable-cxx 命令效果:

image

make 命令效果:

image

make install 命令效果:

image

6.3 MPFR-4.0.2

  1. wget https://www.mpfr.org/mpfr-current/mpfr-4.0.2.tar.gz
  2. tar -xzvf mpfr-4.0.2.tar.gz
  3. cd mpfr-4.0.2
  4. ./configure
  5. make && make install

make install 命令效果:

image

6.4 cgal-4.14

复制代码
  1. wget http://distfiles.macports.org/cgal/cgal-4.14.tar.xz
  2. xz -d cgal-4.14.tar.xz
  3. tar xvf cgal-4.14.tar
  4. cd CGAL-4.14
  5. mkdir build && cd build
  6. cmake ..
  7. make && make install
复制代码

cmake .. 命令提示未找到,具体安装步骤参考:记一次 Centos7 cmake 版本升级(由 v2.8.12.2 升级至 v3.14.5)_cmake version 2.8.12.2-CSDN博客

image

如果使用yum安装cmake,默认版本是:cmake version 2.8.12.2,在执行cmake ..命令时报以下错误 

image

  • 安装新版本cmake
复制代码
  1. wget https://cmake.org/files/v3.17/cmake-3.17.4.tar.gz
  2. tar -zxvf cmake-3.17.4.tar.gz
  3. cd cmake-3.17.4
  4. ./configure --prefix=/usr/local/cmake
  5. make
  6. make install
  7. #创建链接
  8. ln -s /usr/local/cmake/bin/cmake /usr/bin/cmake
复制代码
  • 修改环境变量,查看版本

复制代码

  1. vim /etc/profile
  2. export CMAKE_HOME=/usr/local/cmake
  3. export PATH=$PATH:$CMAKE_HOME/bin
  4. #使配置生效
  5. source /etc/profile
  6. #查看版本
  7. cmake –version
复制代码

接下来继续安装cgal-4.14,进入/usr/local/src/CGAL-4.14/build,执行cmake .. 命令正常效果:

image

make 命令效果:

image

make install 命令效果:

image

安装过程中可能会出现以下错误

image

解决方法: 修改/usr/include/boost/ cstdint.hpp 44行代码为:

image

  1. #if defined(BOOST_HAS_STDINT_H) \
  2. && (!defined(__GLIBC__) \
  3. || defined(__GLIBC_HAVE_LONG_LONG) \
  4. || (defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 17)))))

6.5 SFCGAL 1.3.7

复制代码
  1. wget https://github.com/Oslandia/SFCGAL/archive/v1.3.7.tar.gz
  2. tar -zxvf SFCGAL-1.3.7.tar.gz
  3. cd SFCGAL-1.3.7
  4. mkdir build && cd build
  5. cmake -DCMAKE_INSTALL_PREFIX=/usr/local/sfcgal ..
  6. make && make install
  7. echo "/usr/local/sfcgal/lib64" > /etc/ld.so.conf.d/sfcgal-1.3.7.conf
  8. ldconfig

复制代码

make 命令效果:

image

make install 命令效果:

image

7、pcre-8.44安装

复制代码
  1. wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
  2. tar -xzvf pcre-8.44.tar.gz
  3. cd pcre-8.44
  4. ./configure --enable-utf8 --prefix=/usr/local/pcre
  5. make && make intall
  6. echo "/usr/local/pcre/lib" > /etc/ld.so.conf.d/pcre-8.44.conf
  7. ldconfig

复制代码

./configure --enable-utf8 --prefix=/usr/local/pcre 命令效果:

image

make 命令效果:

image

make install 命令效果:

image

8、libxml2-2.9.10安装

复制代码
  1. wget http://xmlsoft.org/sources/libxml2-2.9.10.tar.gz
  2. tar -xzvf libxml2-2.9.10.tar.gz
  3. cd libxml2-2.9.10
  4. ./configure --prefix=/usr/local/libxml2
  5. make && make intall
  6. echo "/usr/local/libxml2/lib" > /etc/ld.so.conf.d/libxml2-2.9.10.conf
  7. ldconfig
复制代码

make命令,遇到错误提示“libxml.c:14:20: fatal error: Python.h: No such file or directory”

image

解决方法如下:

复制代码
  1. # 可以先查看一下含python-devel的包
  2. yum search python | grep python-devel
  3. # 64位安装python-devel.x86_6432位安装python-devel.i686,我这里安装:
  4. sudo yum install python-devel.x86_64
  5. # 进入/usr/include/python2.7看一下现在有没有Python.h,版本不同目录名不同,我这里是2.7版本。
  6. # 其实也可以看到很多.h文件,python需要库或头文件都在这个地方。
复制代码

make 命令正常效果:

image

make install 命令效果:

image

9、编译gdal.jar进行 java开发,不需要开发,可以跳过

9.1、 ant 1.10.12

  1. wget https://mirrors.tuna.tsinghua.edu.cn/apache//ant/binaries/apache-ant-1.10.12-bin.tar.gz
  2. tar -zxvf apache-ant-1.10.12-bin.tar.gz
  3. mv apache-ant-1.10.12 /usr/local/ant

9.2、swig 4.0.1

  1. wget http://prdownloads.sourceforge.net/swig/swig-4.0.1.tar.gz
  2. tar -zxvf swig-4.0.1.tar.gz
  3. cd swig-4.0.1
  4. bash ./configure --prefix=/usr/local/swig --without-pcre
  5. make && make install
./configure --prefix=/usr/local/swig --without-pcre 命令效果:

image

make 命令效果:

image

make install 命令效果:

image

9.3、配置profile

vim /etc/profile

  1. ANT_HOME=/usr/local/ant
  2. SWIG_HOME=/usr/local/swig
  3. PATH=$ANT_HOME/bin:$SWIG_HOME/bin:$PATH
  4. export ANT_HOME SWIG_HOME

source /etc/profile

查看版本
ant –version

image

swig –version

image

四、安装GDAL 3.0.4

1、编译gdal

复制代码
  1. wget http://download.osgeo.org/gdal/3.0.4/gdal-3.0.4.tar.gz
  2. tar -xf gdal-3.0.4.tar.gz
  3. cd gdal-3.0.4
  4. bash ./configure --prefix=/usr/local/pgsql/plugin/gdal --with-proj=/usr/local/pgsql/plugin/proj --with-geos=/usr/local/pgsql/plugin/geos/bin/geos-config --with-libjson-c=/usr/local/pgsql/plugin/json-c
  5. make && make install
  6. echo "/usr/local/pgsql/plugin/gdal/lib" > /etc/ld.so.conf.d/gdal-3.0.4.conf
  7. ldconfig
复制代码

make 命令效果:

image

make install 命令效果:

image

2、配置GDAL环境变量

通过vi /etc/profile去配置gdal/lib、gdal/bin、gdal/data吧,也可以把profile下载到本地改完再上传

复制代码

  1. GDAL_HOME=/usr/local/pgsql/plugin/gdal
  2. GDAL_DATA=$GDAL_HOME/share/gdal
  3. LD_LIBRARY_PATH=$GDAL_HOME/lib:/usr/local/lib64:$JRE_HOME/lib:$LD_LIBRARY_PATH
  4. PATH=$GDAL_HOME/bin:$PATH
  5. export PATH LD_LIBRARY_PATH GDAL_DATA
复制代码

3、GDAL安装完成,看看版本号和支持的数据格式吧

gdalinfo –version

image

ogr2ogr --formats

image

  • 如只编译GDAL的同学,下面的内容可以不用看了,安装PostGIS的同学,请继续

五、编译安装PostGIS

1、编译

复制代码

  1. wget https://download.osgeo.org/postgis/source/postgis-3.0.1.tar.gz
  2. tar -xvzf postgis-3.0.1.tar.gz
  3. cd postgis-3.0.1
  4. ./configure --with-pgconfig=/usr/local/pgsql/bin/pg_config --with-geosconfig=/usr/local/pgsql/plugin/geos/bin/geos-config --with-projdir=/usr/local/pgsql/plugin/proj --with-gdalconfig=/usr/local/pgsql/plugin/gdal/bin/gdal-config --with-jsondir=/usr/local/pgsql/plugin/json-c --with-pcredir=/usr/local/pcre
  5. make && make install
复制代码

./configure 命令效果:

image

image

make 命令效果:

image

make install 命令效果:

image

如果编译安装PostGIS报错:

undefined reference to `sqlite3_column_origin_name',解决链接参考:https://www.cnblogs.com/xuanmanstein/p/13227545.html

具体做法是在源码文件夹下

  1. cd /usr/local/src/sqlite-autoconf-3360000
  2. vi ./sqlite3.c

添加

  1. #define SQLITE_CORE 1
  2. #define SQLITE_AMALGAMATION 1
  3. #ifndef SQLITE_PRIVATE
  4. # define SQLITE_PRIVATE static
  5. #endif

然后 再

  1. ./configure
  2. make
  3. make install

2、安装fuzzystrmatch扩展

  1. cd /usr/local/src/postgresql-12.2/contrib/fuzzystrmatch
  2. make && make install

make 命令效果:

image

make install 命令效果:

image

3、创建PostGiS数据库

  • 为了PostGIS插件生效,停止启动服务
  1. systemctl stop postgresql.service
  2. systemctl start postgresql.service
  • 创建数据库
复制代码
  1. #切换postgres用户
  2. su postgres
  3. #登录PG数据库
  4. psql
  5. # 创建数据库
  6. create database postgis;
  7. #切换到postgis库中
  8. \c postgis
  9. #显示一下扩展模块
  10. \dx
复制代码

image

4、创建Postgresql扩展

  1. create extension postgis;
  2. create extension postgis_topology;
  3. create extension fuzzystrmatch;
  4. create extension postgis_tiger_geocoder;

4.1、错误

create extension postgis; 报错如下:

could not load library "/usr/local/pgsql/lib/postgis-3.so": libprotobuf-c.so.1

  1. vi /etc/ld.so.conf
  2. #依赖库比较多时,就直接把依赖库lib加入系统共享库,如
  3. /usr/local/lib
  4. ldconfig

image

重新启动postgresql数据库。

4.2 扩展成功创建

image

六、发布gdal项目、读取TIF高程文件,根据经纬度获取海拔

1、必须正常执行以下步骤

       三、编译GDAL依赖

       四、编译GDAL 3.0.4

2、编译生成gdal.jar

2.1 配置java.opt

  1. 修改文件:/usr/local/src/gdal-3.0.4/swig/java/java.opt,修改JAVA_HOME的值为java的根目录
  2. JAVA_HOME = /usr/local/jdk1.8.0_281

2.2 编译

  1. cd /usr/local/src/gdal-3.0.4/swig/java
  2. make && make install

3、JavaWeb应用的 gdal环境配置

3.1、整理文件,把生成的文件放置到gdal/java目录

  1. mkdir -p /usr/local/pgsql/plugin/gdal/java
  2. cp /usr/local/src/gdal-3.0.4/swig/java/gdal.jar /usr/local/pgsql/plugin/gdal/java
  3. cp /usr/local/src/gdal-3.0.4/swig/java/.libs/*.so /usr/local/pgsql/plugin/gdal/java

3.2、在centos下, java.library.path/usr/local/jdk1.8.0_281/lib/amd64,放置libgdalalljni.so到此目录,javaWeb项目从这里加载libgdalalljni.so动态库

cp /usr/local/src/gdal-3.0.4/swig/java/.libs/*.so /usr/local/jdk1.8.0_281/lib/amd64

3.3、把/swig/java中生成的gdal.jar文件复制到jre/lib/ext,jvm启动加载

  1. cp /usr/local/src/gdal-3.0.4/swig/java/gdal.jar /usr/local/jdk1.8.0_281/jre/lib/ext
  2. vi /etc/profile
  3. CLASS_PATH=$JAVA_HOME/jre/lib/ext/gdal.jar:$CLASS_PATH
  4. source /etc/profile

3.4、在/usr/local/gdal-3.0.4/swig/java/目录下复制gdal.jar、libgdalalljni.so文件到项目resources/gdal/linux

image

4、启动JavaWeb看看吧

  • 载入动态库libgdalalljni.so

http://192.168.1.82:8080/gdal/api/gdal/load

  • 注册gdal驱动

http://192.168.1.82:8080/gdal/api/gdal/register

  • shp转geojson

http://192.168.1.82:8080/gdal/api/gdal/test/shp

  • 根据经纬度查询海拔

http://192.168.1.82:8080/gdal/api/gdal/selectAltitude?lon=101.971729&lat=38.246638

image

2698296E-FA90-447a-9C19-551F9B3B903B

5、可能出现的问题

  • 错误1: java.lang.UnsatisfiedLinkError: Native Library /usr/java/packages/lib/amd64/libgdalalljni.so already loaded in another classloader
jvm启动时已经加载过libgdalalljni.so,不能能再次加载了,在linux系统上无需代码加载libgdalalljni.so
  • 错误2:libpq.so.5: cannot open shared object file: No such file or directory 原因是未设置pg库到系统动态库配置请设置ld.so.conf
  1. echo '/usr/local/pgsql/lib' >> /etc/ld.so.conf
  2. ldconfig
  • 错误3:nested exception is java.lang.UnsatisfiedLinkError: org.gdal.ogr.ogrJNI.RegisterAll()V
  1. gdal.jar未放置到/usr/local/jdk1.8.0_281/jre/lib/ext
  2. vi /etc/profile
  3. CLASS_PATH=$JAVA_HOME/jre/lib/ext/gdal.jar:$CLASS_PATH
  4. source /etc/profile

项目源码:GitHub - hlb3696/geodb-gdal: 根据经纬度获取海拔

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/秋刀鱼在做梦/article/detail/870452
推荐阅读
相关标签
  

闽ICP备14008679号