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? Thanks a lot, Tom
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
On 4 Oct 2009, at 12:19, Jon Burgess wrote: > 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?Jon, thanks for helping out. I'm using 4.7.1.> 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.00Erk! $ 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 Using from definition: proj=latlong ellps=GRS80 no_defs Rel. 4.7.1, 23 September 2009 <cs2cs>: projection initialization failure cause: major axis or radius = 0 or not given program abnormally terminated
On Sun, 2009-10-04 at 12:27 +0100, Tom Taylor wrote: > On 4 Oct 2009, at 12:19, Jon Burgess wrote: > > > 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? > > > Jon, thanks for helping out. > > I'm using 4.7.1.4.7.1 does not exist @ http://download.osgeo.org/proj/ do you mean an SVN version?> > 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 > > Erk! > > $ 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 > Using from definition: proj=latlong ellps=GRS80 no_defs > Rel. 4.7.1, 23 September 2009 > <cs2cs>: > projection initialization failure > cause: major axis or radius = 0 or not given > program abnormally terminatedVery odd. I just downloaded the proj SVN code, rebuilt & installed and it still works for me. How about if you use all the definitions provided with proj: $ echo 45 45 | cs2cs +init=epsg:4326 +to +init=esri.extra:900913 5009377.09 5621521.49 0.00 $ cs2cs Rel. 4.7.1, 23 September 2009 usage: cs2cs [ -eEfIlrstvwW [args] ] [ +opts[=arg] ] [+to [+opts[=arg] [ files ] Jon
On 4 Oct 2009, at 13:16, Jon Burgess wrote: > 4.7.1 does not exist @ http://download.osgeo.org/proj/ > do you mean an SVN version?Sorry, yes, I downloaded proj-4.7.0.tar.gz, it just seems to identify itself as 4.7.1 in the version info in executable.> $ echo 45 45 | cs2cs +init=epsg:4326 +to +init=esri.extra:900913 > 5009377.09 5621521.49 0.00That works.> $ cs2cs > Rel. 4.7.1, 23 September 2009 > usage: cs2cs [ -eEfIlrstvwW [args] ] [ +opts[=arg] ] > [+to [+opts[=arg] [ files ] >As does that.
On Sun, 2009-10-04 at 13:28 +0100, Tom Taylor wrote:
>
> On 4 Oct 2009, at 13:16, Jon Burgess wrote:
>
> > 4.7.1 does not exist @ http://download.osgeo.org/proj/
> > do you mean an SVN version?
>
> Sorry, yes, I downloaded proj-4.7.0.tar.gz, it just seems to
> identify
> itself as 4.7.1 in the version info in executable.
>
> > $ echo 45 45 | cs2cs +init=epsg:4326 +to +init=esri.extra:900913
> > 5009377.09 5621521.49 0.00
>
> That works.I updated the proj strings to match those in the 4.7.1 definition files
in r17981. Can you see if those work for you now?
Jon
On 4 Oct 2009, at 13:49, Jon Burgess wrote:
> I updated the proj strings to match those in the 4.7.1 definition
> files
> in r17981. Can you see if those work for you now?Jon, I'm afraid not:
$ ./osm2pgsql -d osm ~/Downloads/great_britain.osm.bz2
osm2pgsql SVN version 0.67-17981
Projection code failed to initialise
On Sun, 2009-10-04 at 14:04 +0100, Tom Taylor wrote:
> On 4 Oct 2009, at 13:49, Jon Burgess wrote:
>
> > I updated the proj strings to match those in the 4.7.1 definition
> > files
> > in r17981. Can you see if those work for you now?
>
> Jon, I'm afraid not:
>
> $ ./osm2pgsql -d osm ~/Downloads/great_britain.osm.bz2
> osm2pgsql SVN version 0.67-17981
>
> Projection code failed to initialiseI can only think that something is inconsistent in your proj setup, e.g.
maybe mixing a custom proj library with the system projection or datum
definitions.
Can you see which proj library cs2cs & osm2pgsql are using?
Something like this:
$ ldd osm2pgsql | grep proj
libproj.so.0 => /usr/lib64/libproj.so.0 (0x00007fd198360000)
$ type cs2cs
cs2cs is hashed (/usr/bin/cs2cs)
[jburgess at shark osm2pgsql]$ ldd /usr/bin/cs2cs | grep proj
libproj.so.0 => /usr/lib64/libproj.so.0 (0x00007ff3a4468000)
Then if you feel like digging deeper to see what the code for each
program does when asked to initialize the projections then collect the
strace output:
$ strace -o /tmp/osm2pgsql.txt -f osm2pgsql great_britain.osm.bz2
$ strace -o /tmp/cs2cs.txt -f cs2cs +init=epsg:4326 +to +init=esri.extra:900913
Then compares the output in cs2cs.txt vs osm2pgsql.txt. There will be a
lot of information in there. Towards the end you should see it opening
and reading various proj data files from /usr/share/proj (or similar).
If you get stuck, try attaching them to an email and send direct to me.
They will be too big for the email list.
Jon
On 4 Oct 2009, at 14:31, Jon Burgess wrote: > Can you see which proj library cs2cs & osm2pgsql are using? > Something like this:This seems to be the equivalent tool on OS X: $ otool -l /usr/local/bin/cs2cs |grep proj name /usr/local/Cellar/proj/4.7.0/lib/libproj.0.dylib (offset 24) $ otool -l ./osm2pgsql |grep proj name /usr/local/Cellar/proj/4.7.0/lib/libproj.0.dylib (offset 24)> Then if you feel like digging deeper to see what the code for each > program does when asked to initialize the projections then collect the > strace output: > > $ strace -o /tmp/osm2pgsql.txt -f osm2pgsql great_britain.osm.bz2 > $ strace -o /tmp/cs2cs.txt -f cs2cs +init=epsg:4326 +to > +init=esri.extra:900913 > > Then compares the output in cs2cs.txt vs osm2pgsql.txt. There will > be a > lot of information in there. Towards the end you should see it opening > and reading various proj data files from /usr/share/proj (or similar).Using dtruss, which is pretty much the same, to trace the execution - they both just refer to the same library: /usr/local/Cellar/proj/4.7.0/ lib/libproj.0.dylib. I guess I'll give up on it on OS X for the time being. I've got an Ubuntu Virtual Machine here which is probably going to be a lot easier! Thanks for your help Jon - much appreciated.
Tom, There are 10.6 ready binaries of the latest stable release of proj.4 available here: http://www.kyngchaos.com/software:frameworks I use this proj distribution on OSX frequently and have not had a problem. If you try this approach, just patch your osm2pgsql Makefile like so: Index: Makefile =================================--- Makefile (revision 17981) +++ Makefile (working copy) @@ -7,6 +7,7 @@ CFLAGS += -g -O2 -Wall -Wextra CFLAGS += $(shell xml2-config --cflags) +CFLAGS += -I/Library/Frameworks/PROJ.framework/unix/include CFLAGS += $(shell geos-config --cflags) CFLAGS += -I$(shell pg_config --includedir) CFLAGS += -DVERSION=\"$(VERSION)-$(SVN)\" @@ -19,7 +20,8 @@ LDFLAGS += $(shell geos-config --libs) LDFLAGS += -L$(shell pg_config --libdir) -lpq LDFLAGS += -lbz2 -lz -LDFLAGS += -g -lproj +#LDFLAGS += -g -lproj +LDFLAGS += -L/Library/Frameworks/PROJ.framework/unix/lib -lproj LDFLAGS += -lstdc++ LDFLAGS += -lpthread DaneOn Oct 4, 2009, at 7:14 AM, Tom Taylor wrote: > > On 4 Oct 2009, at 14:31, Jon Burgess wrote: > >> Can you see which proj library cs2cs & osm2pgsql are using? >> Something like this: > > This seems to be the equivalent tool on OS X: > > $ otool -l /usr/local/bin/cs2cs |grep proj > name /usr/local/Cellar/proj/4.7.0/lib/libproj.0.dylib > (offset 24) > $ otool -l ./osm2pgsql |grep proj > name /usr/local/Cellar/proj/4.7.0/lib/libproj.0.dylib > (offset 24) > >> Then if you feel like digging deeper to see what the code for each >> program does when asked to initialize the projections then collect >> the >> strace output: >> >> $ strace -o /tmp/osm2pgsql.txt -f osm2pgsql great_britain.osm.bz2 >> $ strace -o /tmp/cs2cs.txt -f cs2cs +init=epsg:4326 +to >> +init=esri.extra:900913 >> >> Then compares the output in cs2cs.txt vs osm2pgsql.txt. There will >> be a >> lot of information in there. Towards the end you should see it >> opening >> and reading various proj data files from /usr/share/proj (or >> similar). > > Using dtruss, which is pretty much the same, to trace the execution - > they both just refer to the same library: /usr/local/Cellar/proj/ > 4.7.0/ > lib/libproj.0.dylib. > > I guess I'll give up on it on OS X for the time being. I've got an > Ubuntu Virtual Machine here which is probably going to be a lot > easier! > > Thanks for your help Jon - much appreciated. > > _______________________________________________ > dev mailing list > dev at openstreetmap.org > http://lists.openstreetmap.org/listinfo/dev
On 4 Oct 2009, at 16:12, Dane Springmeyer wrote:
> There are 10.6 ready binaries of the latest stable release of proj.4
> available here:
>
> http://www.kyngchaos.com/software:frameworksThanks Dane, that did the trick. Not sure what was wrong with my proj.
4 installation. I'm importing Great Britain as we speak. Lovely.
On 04/10/09 12:19, Jon Burgess wrote:
> 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.00Well that certainly fails for me:
Rel. 4.6.1, 21 August 2008
<cs2cs>:
projection initialization failure
cause: squared eccentricity < 0
program abnormally terminated
Tom
A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 193 bytes Desc: not available Url : http://lists.openstreetmap.org/pipermail/dev/...