[OSM-dev] Trouble with osm2pgsql and Postgres 8.4, Postgis 1.4

Jon Burgess jburgess777 at googlemail.com
Sun Oct 4 12:19:48 BST 2009


On Sun, 2009-10-04 at 11:19 +0100, Tom Taylor wrote:
> Hi all,
> 
> I'm trying to get an environment up and running for Mapnik on OS X 10.6.
> 
> I'm using Postgres 8.4 and Postgis 1.4. I've compiled osm2pgsql, but  
> whenever I attempt to import data I get the following:
> 
> 	mu:~ tom$ osm2pgsql -m -d osm Downloads/great_britain.osm.bz2
> 	osm2pgsql SVN version 0.67-exported
> 
> 	Projection code failed to initialise
> 
> This is a bit confusing, because I've installed the projection  
> correctly, and I can see it when I do:
> 
> 	osm=# SELECT * from spatial_ref_sys WHERE srid=900913;
> 
> The database was created with the following commands:
> 
> 	$ createdb osm
> 	$ createlang plpgsql osm
> 	$ psql -d osm -f /usr/local/Cellar/postgresql/8.4.0/share/contrib/ 
> postgis.sql
> 	$ psql -d osm -f /usr/local/Cellar/postgresql/8.4.0/share/contrib/ 
> spatial_ref_sys.sql
> 
> If I define the projection on the command line, I get:
> 
> 	$ osm2pgsql -E 900913 -d osm Downloads/great_britain.osm.bz2
> 	osm2pgsql SVN version 0.67-exported
> 
> 	Couldn't read EPSG definition (do you have /usr/share/proj/epsg?)
> 
> I don't - my proj projections are in /usr/local/share/proj. And 900913  
> is in esri.extra.
> 
> If I set it to 4326 (which *is* in /usr/local/share/proj/epsg), I get  
> "Projection code failed to initialise".
> 
> I know I've got a bit of a weird setup - I'm using Homebrew (http://github.com/mxcl/homebrew/ 
> ) - but has anyone got any suggestions of what to do next?

Those error messages all come from reprojection.c which is trying to
initialise the projection using the proj library. This should have
nothing to do with postgres & postgis. What version of proj are you
using?

The proj library gave an error when trying to parse one of these
projection strings:

"+proj=latlong +ellps=GRS80 +no_defs"

"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0
+k=1.0 +units=m +nadgrids=@null +no_defs +over"


Can you try the following command which should project a point using a
command line proj tool:

$ echo 45 45 | cs2cs +proj=latlong +ellps=GRS80 +no_defs +to +proj=merc
+a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0
+units=m +nadgrids=@null +no_defs +over

The answer should come back as:
5009377.09      5621521.49 0.00

	Jon






More information about the dev mailing list