PostGIS
2. 安装
根据开发环境,用户可从 PostGIS安装 页面选择适合自己的方式进行安装PostGIS。
2.1. 源码安装
除PostGIS社区提供的安装方式以外,IvorySQL社区也提供了源码安装方式,源码安装环境为 Ubuntu 24.04(x86_64)。
| 请确保环境中已安装了IvorySQL5.0及以上版本 |
-
安装依赖
sudo apt install \
docbook-xsl-ns \
gettext \
libgdal-dev \
libgeos-dev \
libjson-c-dev \
libproj-dev \
libprotobuf-c-dev \
libsfcgal-dev \
libxml2-dev \
libxml2-utils \
protobuf-c-compiler \
xsltproc
-
安装 PostGIS
$ wget https://download.osgeo.org/postgis/source/postgis-3.5.4.tar.gz $ tar xvf postgis-3.5.4.tar.gz $ cd postgis-3.5.4 $ ./configure --with-pgconfig=/path/to/pg_config eg: /usr/ivory-5/bin/pg_config,如果ivorysql安装目录在/usr/ivory-5. $ make $ sudo make install
如出现PGXS报错, 请根据环境中IvorySQL安装路径, 修改—with-pgconfig的参数值。
3. 创建Extension并确认PostGIS版本
psql 连接到数据库,执行如下命令:
ivorysql=# CREATE extension postgis; CREATE EXTENSION ivorysql=# SELECT * FROM pg_available_extensions WHERE name = 'postgis'; name | default_version | installed_version | comment ---------+-----------------+-------------------+------------------------------------------------------------ postgis | 3.5.4 | 3.5.4 | PostGIS geometry and geography spatial types and functions (1 row)
4. 使用
关于PostGIS的使用,请参阅 PostGIS3.5官方文档