The problem of creating a PostGIS template database

I am trying to create a template database for PostGIS (1.5) for Mac OS X Snow Leopard (10.6) for my GeoDjango application.

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

I managed to get to the point where the provided postgis.sql should be started (i.e. psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql)

At this point, I get an error in the first SQL query that I am trying to execute. When I try this at the psql prompt, the result will be as follows:

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

Any ideas that could be messed up?

+3
source share
3 answers

, . , GEOS v2, v3 .

+2

PostGIS PostGIS KML

+1

This error indicates that the shared object was not found. The most obvious reason is that PostGIS has not been installed (correctly). Moreover, the order in which the SQL scripts from the contrib / postgis-1.5 folder are installed is important.

I have successfully used this order and (Linux shell commands):

$ 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

After that there should be about 800 functions, several new types and some overloaded operator.

+1
source

Source: https://habr.com/ru/post/1783458/


All Articles