Linux   发布时间:2022-03-31  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了st_frechetdistance函数报错解决(postgis)--Linux大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

st_frechetdistance函数报错解决(Postgis)   一。问题描述   SELECT st_frechetdistance(‘LINEStriNG(0 0,100 0)‘::geometry, ‘LINEStriNG(0 0,50 50,100 0)‘::geometry);   ERROR:  The GEOS version this PostgIS binary was c
st_frechetdistance函数报错解决(Postgis)
 
一。问题描述
 
SELECT st_frechetdistance(‘LINEStriNG(0 0,100 0)‘::geometry,‘LINEStriNG(0 0,50 50,100 0)‘::geometry);
 
ERROR:  The GEOS version this PostgIS binary was compiled against (36) doesn‘t support ‘GEOSFechetDistance‘ function (3.7.0+ required)
错误PostgIS二进制文件编译的GEOS版本(36)不支持‘GEOSFechetDistance‘功能(需要3.7.0+)@H_607_34@
 
查看Postgis版本,发现geos版本确实是36
SELEct Postgis_full_version();
PostgIS="2.5.0 r16836" [EXTENSION] PGsql="100" GEOS="3.6.1-CAPI-1.10.1 r0" PROJ="Rel. 4.9.3,15 August 2016" GDAL="GDAL 2.1.2,released 2016/10/24" LIBXML="2.9.7"
LIBJSON="0.13.1" TOPOLOGY RASTER
 
 
二。解决思路
 
升级geos版本,卸载Postgis(找到安装目录,用make uninstall卸载),重新安装Postgis@H_607_34@
 
 
三。具体做法(Linux POSTGResql,Postgis,geos等软件皆是源码安装)
 
 
1.停止POSTGResql服务
 
service POSTGResql stop
 
 
2.卸载geos(之前是安装到/usr/local/geos-3.6.1这边的)
 
cd /usr/local
 
rm -f -r geos-3.6.1
 
cd /usr/resource/pg/plugin
 
rm -f -r geos-3.6.1
 
rm -f -r geos-3.6.1.tar.bz2
 
 
3.重装更高版本的geos
 
tar -jxf geos-3.7.1.tar.bz2
cd geos-3.7.1
./configure --prefix=/usr/local/geos-3.7.1
make
make install
 
 
4. 卸载Postgis,再重装或者升级@H_607_34@
 
 
4-1. 配置ld.so.conf
[ [email protected]_0_4_centos opt]# vi /etc/ld.so.conf
#编辑内容如下(之前geos是3.6.1,现改成3.7.1)
 
 
include ld.so.conf.d/*.conf
/usr/local/pgsql/lib
/usr/local/proj-4.9.3/lib
/usr/local/gdal-2.1.2/lib
/usr/local/geos-3.7.1/lib
/usr/local/json-c-0.13.1/lib
/usr/local/libxml2-2.9.7/lib
 
 
#编辑完成后wq!保存退出
#保存配置,重启生效
ldconfig -v
 
4-2. 卸载PostgIS,再安装(升级)
 
cd /usr/resource/pg/plugin/Postgis-2.5.0
 
# 先卸载@H_607_34@
make uninstall
 
# 删除之前的文件@H_607_34@
cd ../
rm -f -r Postgis-2.5.0
 
# 重新解压安装(或者升级)@H_607_34@
tar -zxvf Postgis-2.5.0.tar.gz
cd Postgis-2.5.0
./configure --prefix=/usr/local/pgsql --with-gdalconfig=/usr/local/gdal-2.1.2/bin/gdal-config --with-pgconfig=/usr/local/pgsql/bin/pg_config --with-geosconfig=/usr/local/geos-3.7.1/bin/geos-config --with-projdir=/usr/local/proj-4.9.3 --with-xml2config=/usr/local/libxml2-2.9.7/bin/xml2-config --with-jsondir=/usr/local/json-c-0.13.1
make
make install
 
 
5.启动数据库,执行PostgIS插件更新语句
 
service POSTGResql start
 
接下来在各个空间数据库内,执行PostgIS插件更新语句:
    
alter extension Postgis update
 
 
6.验证
 
6-1.依赖验证    ldd /usr/local/pgsql/lib/Postgis_topology-2.5.so
 
发现Postgis依赖已经指向新装的geos3.7.1
 

st_frechetdistance函数报错解决(postgis)--Linux

st_frechetdistance函数报错解决(postgis)--Linux

 
6-2.版本验证
 
SELEct Postgis_full_version();
 
geos也是变成了3.7.1
 
6-3.函数验证
 
SELECT st_frechetdistance(‘LINEStriNG(0 0,100 0)‘::geometry);
 
可以正常执行了

大佬总结

以上是大佬教程为你收集整理的st_frechetdistance函数报错解决(postgis)--Linux全部内容,希望文章能够帮你解决st_frechetdistance函数报错解决(postgis)--Linux所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。