创建PostGIS模板数据库时出错

时间:2011-01-04 17:57:47

标签: macos postgis geodjango

我正在尝试为我的GeoDjango应用程序在Mac OS X Snow Leopard(10.6)上为PostGIS(1.5)构建模板地理数据库。

我跟随: http://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#creating-a-spatial-database-template-for-postgis

我设法达到了应该运行提供的postgis.sql的程度(即psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql

此时我在尝试运行的第一个SQL语句中收到错误。当我在psql提示符上尝试时,结果如下:

template_postgis=# CREATE OR REPLACE FUNCTION st_spheroid_in(cstring) RETURNS spheroid AS '/usr/local/pgsql/lib/postgis-1.5','ellipsoid_in' LANGUAGE 'C' IMMUTABLE STRICT;
NOTICE:  type "spheroid" is not yet defined
DETAIL:  Creating a shell type definition.
ERROR:  could not load library "/usr/local/pgsql/lib/postgis-1.5.so": dlopen(/usr/local/pgsql/lib/postgis-1.5.so, 10): Symbol not found: _DatumGetFloat4
  Referenced from: /usr/local/pgsql/lib/postgis-1.5.so
  Expected in: /opt/local/lib/postgresql83/bin/postgres 
 in /usr/local/pgsql/lib/postgis1.5.so

有什么想法可能搞砸了吗?

3 个答案:

答案 0 :(得分:2)

检查是否安装了正确的先决条件库。我安装了GEOS v2后出现了同样的错误,升级到v3修复了这个问题。

答案 1 :(得分:1)

以下是我为PostGIS设置模板数据库的方法 Landsliding Into PostGIS With KML Files

答案 2 :(得分:1)

此错误表示找不到共享对象。最明显的原因是PostGIS尚未安装(正确)。此外,安装contrib / postgis-1.5文件夹的SQL脚本的顺序非常重要。

我已成功使用此订单和(Linux shell命令):

$ psql -U postgres -d database -f /usr/share/postgresql/9.0/contrib/_int.sql
$ psql -U postgres -d database  -f /usr/share/postgresql/9.0/contrib/pg_trgm.sql
$ psql -U postgres -d database  -f /usr/share/postgresql/9.0/contrib/postgis-1.5/postgis.sql
$ psql -U postgres -d database  -f /usr/share/postgresql/9.0/contrib/postgis-1.5/spatial_ref_sys.sql

在此之后,应该有大约800个函数,一些新类型和一些重载运算符可用。