postgis拡張パッケージfuzzystrmatchとpostgis_tiger_geocoderのインストール

                                      postgis拡張パッケージとpostgis_tiger_geocoderのインストール

通常、postgisをインストールした後、pgデータベースに入り、プラグインにクエリを実行し、次のようにプラグインの状況を表示します。

postgres=# select * from pg_available_extensions where name like 'postgis%';
          name          | default_version | installed_version |                               comment                               
------------------------+-----------------+-------------------+---------------------------------------------------------------------
 postgis                | 3.0.0           | 3.0.0             | PostGIS geometry, geography, and raster spatial types and functions
 postgis_tiger_geocoder | 3.0.0           |              | PostGIS tiger geocoder and reverse geocoder
 postgis_raster         | 3.0.0           |            | PostGIS raster types and functions
 postgis_topology       | 3.0.0           |             | PostGIS topology spatial types and functions
 postgis_sfcgal         | 3.0.0           | 3.0.0             | PostGIS SFCGAL functions
(5 rows)

ご覧のとおり、2、3、および4は有効になっていません。つまり、デフォルトでは有効になっていないので、どのように有効にしますか?

postgres=# create extension postgis_tiger_geocoder;
ERROR:  required extension "fuzzystrmatch" is not installed
HINT:  Use CREATE EXTENSION ... CASCADE to install required extensions too.

上の図は、postgis_tiger_geocoderを有効にするには、最初にfuzzystrmatchをインストールする必要があることを示しています。

fuzzystrmatch拡張機能はpostgresqlソースインストールパッケージのcontribディレクトリにあり、fuzzystrmatchディレクトリに入り、&& makeinstallを実行します。プロセスは次のとおりです。

[root@centos2 fuzzystrmatch]# make
make -C ../../src/backend generated-headers
make[1]: Entering directory `/root/postgre12.5/postgresql-12.5/src/backend'
make -C catalog distprep generated-header-symlinks
make[2]: Entering directory `/root/postgre12.5/postgresql-12.5/src/backend/catalog'
make[2]: Nothing to be done for `distprep'.
make[2]: Nothing to be done for `generated-header-symlinks'.
make[2]: Leaving directory `/root/postgre12.5/postgresql-12.5/src/backend/catalog'
make -C utils distprep generated-header-symlinks
make[2]: Entering directory `/root/postgre12.5/postgresql-12.5/src/backend/utils'
make[2]: Nothing to be done for `distprep'.
make[2]: Nothing to be done for `generated-header-symlinks'.
make[2]: Leaving directory `/root/postgre12.5/postgresql-12.5/src/backend/utils'
make[1]: Leaving directory `/root/postgre12.5/postgresql-12.5/src/backend'
gcc -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I. -I../../src/include  -D_GNU_SOURCE   -c -o fuzzystrmatch.o fuzzystrmatch.c
gcc -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I. -I../../src/include  -D_GNU_SOURCE   -c -o dmetaphone.o dmetaphone.c
gcc -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -shared -o fuzzystrmatch.so fuzzystrmatch.o dmetaphone.o  -L../../src/port -L../../src/common    -Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags  
[root@centos2 fuzzystrmatch]# echo $?
0
[root@centos2 fuzzystrmatch]# make install
make -C ../../src/backend generated-headers
make[1]: Entering directory `/root/postgre12.5/postgresql-12.5/src/backend'
make -C catalog distprep generated-header-symlinks
make[2]: Entering directory `/root/postgre12.5/postgresql-12.5/src/backend/catalog'
make[2]: Nothing to be done for `distprep'.
make[2]: Nothing to be done for `generated-header-symlinks'.
make[2]: Leaving directory `/root/postgre12.5/postgresql-12.5/src/backend/catalog'
make -C utils distprep generated-header-symlinks
make[2]: Entering directory `/root/postgre12.5/postgresql-12.5/src/backend/utils'
make[2]: Nothing to be done for `distprep'.
make[2]: Nothing to be done for `generated-header-symlinks'.
make[2]: Leaving directory `/root/postgre12.5/postgresql-12.5/src/backend/utils'
make[1]: Leaving directory `/root/postgre12.5/postgresql-12.5/src/backend'
/usr/bin/mkdir -p '/usr/local/pgsql/lib'
/usr/bin/mkdir -p '/usr/local/pgsql/share/extension'
/usr/bin/mkdir -p '/usr/local/pgsql/share/extension'
/usr/bin/install -c -m 755  fuzzystrmatch.so '/usr/local/pgsql/lib/fuzzystrmatch.so'
/usr/bin/install -c -m 644 ./fuzzystrmatch.control '/usr/local/pgsql/share/extension/'
/usr/bin/install -c -m 644 ./fuzzystrmatch--1.1.sql ./fuzzystrmatch--1.0--1.1.sql ./fuzzystrmatch--unpackaged--1.0.sql  '/usr/local/pgsql/share/extension/'
[root@centos2 fuzzystrmatch]# echo $?

 

pgデータベースに再度入力し、エラーなしで次のコマンドを実行します。

postgres=# CREATE EXTENSION fuzzystrmatch; 
CREATE EXTENSION
postgres=# create extension postgis_tiger_geocoder;
CREATE EXTENSION

 

おすすめ

転載: blog.csdn.net/alwaysbefine/article/details/114987779