我在用geoDjango.我已经从源代码安装下面的软件包Gdal,proj1.4,geos3.3.5和Postgis2.0.1.我是ubuntu用户.当我跑完syncdb后,我得到以下错误.我错过了什么吗?谢谢
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Failed to install index for cities.City model: operator class "gist_geometry_ops" does not exist for access method "gist"
Failed to install index for cities.District model: operator class "gist_geometry_ops" does not exist for access method "gist"
Failed to install index for cities.PostalCodeCA model: operator class "gist_geometry_ops" does not exist for access method "gist"
Installed 0 object(s) from 0 fixture(s)
Run Code Online (Sandbox Code Playgroud)
小智 8
也许我有点迟了但我解决了这个问题(Django 1.4.x,Postgis 2.0.1和PostgreSQL 9.2)在template_postgis数据库中创建一个运算符类,如下所示:
CREATE OPERATOR CLASS gist_geometry_ops
FOR TYPE geometry USING GIST AS
STORAGE box2df,
OPERATOR 1 << ,
OPERATOR 2 &< ,
OPERATOR 3 && ,
OPERATOR 4 &> ,
OPERATOR 5 >> ,
OPERATOR 6 ~= ,
OPERATOR 7 ~ ,
OPERATOR 8 @ ,
OPERATOR 9 &<| ,
OPERATOR 10 <<| ,
OPERATOR 11 |>> ,
OPERATOR 12 |&> ,
OPERATOR 13 <-> FOR ORDER BY pg_catalog.float_ops,
OPERATOR 14 <#> FOR ORDER BY pg_catalog.float_ops,
FUNCTION 8 geometry_gist_distance_2d (internal, geometry, int4),
FUNCTION 1 geometry_gist_consistent_2d (internal, geometry, int4),
FUNCTION 2 geometry_gist_union_2d (bytea, internal),
FUNCTION 3 geometry_gist_compress_2d (internal),
FUNCTION 4 geometry_gist_decompress_2d (internal),
FUNCTION 5 geometry_gist_penalty_2d (internal, internal, internal),
FUNCTION 6 geometry_gist_picksplit_2d (internal, internal),
FUNCTION 7 geometry_gist_same_2d (geom1 geometry, geom2 geometry, internal);
Run Code Online (Sandbox Code Playgroud)
这是从这个链接中提取的http://trac.osgeo.org/postgis/ticket/1287#comment:8
您需要创建一个postgis模板并加载相关的postgis.sql
假设你的 postgis 路径是 /usr/share/postgresql/8.4/contrib 运行这个
POSTGIS_SQL_PATH=/usr/share/postgresql/8.4/contrib sudo -u postgres createb -E UTF8 template_postgis1 # 创建模板空间数据库。 sudo -u postgres createlang -d template_postgis1 plpgsql # 添加 PLPGSQL 语言支持。 sudo -u postgres psql -d postgres -c "更新 pg_database SET datistemplate='true' WHERE datname='template_postgis1';" sudo -u postgres psql -d template_postgis1 -f $POSTGIS_SQL_PATH/postgis.sql # 加载 PostGIS SQL 例程 sudo -u postgres psql -d template_postgis1 -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql sudo -u postgres psql -d template_postgis1 -c“将几何列上的所有内容授予公共;” # 允许用户更改空间表。 sudo -u postgres psql -d template_postgis1 -c“将spatial_ref_sys上的所有内容授予公共;”
然后需要使用创建的模板模板创建您的数据库
sudo -u postgres createdb 数据库名称 -T template_postgis1
| 归档时间: |
|
| 查看次数: |
1479 次 |
| 最近记录: |