3
votes

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

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

I've managed to come up to the point where the provided postgis.sql should be run (i.e. psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql)

At that point I am getting an error at the first SQL statement that is tried to be run. When I try that on the psql prompt the result is 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 what might have been messed up?

3
Weird error. How did you install PostGIS? Have had the best luck with the KyngChaos frameworks on OS X.tcarobruce
first i tried mac ports but it didn't went well, as it tried to reinstall already existing dependencies, etc. so i went the KyngChaos way.onurmatik
i have psql and pg_config and other binaries both under /usr/local/pgsql/bin/ and /opt/local/lib/postgresql83/bin/. does this give a clue about the mess?onurmatik
i removed /opt/local/lib/postgresql83/ manually and installed postgresql 9.0.1 and postgis 1.5.2 using KyngChaos binaries but no luck. i am still getting the same error.onurmatik

3 Answers

2
votes

Check that you have the correct pre-requisite libraries installed. I got this same error when I had GEOS v2 installed, and an upgrade to v3 fixed the issue.

1
votes

Here's how I set up my template database for PostGIS Landsliding Into PostGIS With KML Files

1
votes

This error indicates that the Shared Object is not found. The most obvious reason is that PostGIS has not been installed (properly). Furthermore, the order in which the SQL Scripts from the contrib/postgis-1.5 folder are installed is important.

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

$ 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 this, there should be somewhere around 800 functions, a few new types and some overloaded operator available.