Talk:Osm2pgsql

From OpenStreetMap Wiki
Jump to: navigation, search

Discuss the Osm2pgsql page here:

Please note: For asking support questions, other Contact channels may be better


Osm2pgsql problems building from source

Having some issues with osm2pgsql on Ubuntu 8.04.

Installing using aptitude

Using the aptitude install osm2pgsql install, when I run the command

  • osm2pgsql -c -d osmtest1 south-090218.osm

I get the following error

osm2pgsql SVN version 0.08-20071112 $Rev: 4842 $ 

Setting up table: planet_osm_point
Setting up table: planet_osm_line
Setting up table: planet_osm_polygon
Setting up table: planet_osm_roads

Reading in file: south-090218.osm
Processing: Node(754k) Way(113k) Relation(0k)
Writing way(0k)

Node stats: total(754182), max(347161474)
Way stats: total(113531), max(31211530)
Relation stats: total(273), max(78838)
VACUUM ANALYZE planet_osm_point;
ALTER TABLE planet_osm_point ALTER COLUMN way SET NOT NULL;
CREATE INDEX way_index0 ON planet_osm_point USING GIST (way GIST_GEOMETRY_OPS);
CREATE INDEX z_index0 ON planet_osm_point (z_order);
CLUSTER way_index0 ON planet_osm_point;
GRANT SELECT ON planet_osm_point TO PUBLIC;
VACUUM ANALYZE planet_osm_point;
 failed: ERROR:  VACUUM cannot be executed from a function or multi-command string

Error occurred, cleaning up

A dig online found the following: SVN is currently up to version 0.54 so I suggest you find a newer version.

So I tried the build from source option.

Build from source

The sequence of cmds

run without errors, but try to run;

  • osm2pgsql -c -d osmtest1 south-090218.osm

and I get the msg

The program 'osm2pgsql' is currently not installed.  You can install it by typing:
apt-get install osm2pgsql
bash: osm2pgsql: command not found

Could anyone point out the step I missing to build from source; apt-get install osm2pgsql will install from the online repositary rather than local source right? None of install, sudo make install or clean install install osm2pgsql.

-- User:Nerdling 15:13, 24 February 2009


I had the exact same problem on ubuntu 8.04. After compiling osm2pgsql from source as stated above. Copying osm2pgsql to /usr/bin did it for me.
sudo cp osm2pgsql /usr/bin
osm2pgsql -d <databasename> -s /path/to/file.osm
Hope this helps.
-- User:Emmol 13:18, 10 March 2009

Vacuum fail problem occurs for latest version

Thanks for the tip about copying osm2pgsql to /usr/bin: it resolved that specific issue. However I still have the original 'vacuum' problem (described above wrt aptitude) for this version of osm2pgsql that has been compiled from source.

A dig on this site suggested it might be linked to postgresql autovacuum settings, however setting autovacuum = off in the postgresql.conf file has had no effect on the problem. Once again, advice greatly appreciated.

User:Nerdling 09:40, 14 April 2009

Actually the answer is in the page you're referring to. You need to edit /etc/cron.d/postgresql-common to disable running vacuum when autovacuum = off.
sudo nano -w /etc/cron.d/postgresql-common
-- User:Emmol 08:09, 15 April 2009

How to set other database schema than 'public'?

I have PostGIS database with several schemas. I would like to hold OSM data in a schema called 'osm' but I am not sure how to do it as schema 'public' is always the default one (for both, osm2pgsql and Mapnik?).

-- User:Lasmasi 15:47, 10 July 2009

Windows section:

"Just unzip, add directory to your path and run. ..."

is a bit poor in my opinion for explaining "ordinary" windows users what to do. What is "your path" e.g. ? I think i´m one of the a bit advanced windows user and even have some ideas on how things work in linux, but this explanation is beyond my understanding.

Maybe the osm-freaks don´t see the problem: Most people simply use MS-Software and NOT Linux. Of course it would be better for everyone to learn the "real" way, but getting confronted with all the osm-stuff + learning linux things is way too much for, i bet 99%, of those users. I can tell from my experience, that there is almost no education in geo-related studies with linux software at universities. If this project doesn´t want to be limited to linux freaks, it should take into consideration those ... 90 percent ... of windows users out there having no idea what you are talking about.

-- User:Bernd v. 21:53, 21 July 2009

For sure you'll have a smoother ride doing this stuff on linux (or perhaps on a linux virtual machine?) Windows users installing tools like osm2pgsql are in the minority at the moment. It may well stay that way, since tools like this just aren't very windows friendly (or the compiled windows binaries will not be as reliably maintained and documented).
In fact tools like osm2pgsql are not very non-techy friendly. This isn't really a front line your-mother-could-use-it bit of software like the Editors are aiming to be. Perhaps there is an assumed level of computing competence, so the "What is 'your' path" question (the answer is this by the way) might not even be worth answering, because anyone who doesn't know that will just get stuck on the next thing later on anyway! I don't think that's a very a helpful approach, but I'm sure that's how many people would re-act to your question.
In general it's a wiki. If you can improve the content explaining steps for windows users, please go ahead. If you can't because you don't know, take a deep breath and ask the question without letting your frustration show. Somebody may be willing to help you.
-- Harry Wood 10:23, 3 June 2010 (UTC)
I just Updated the Wiki with the commands for a successful country load for the Philippines on a 2G Windows System. Hope it helps
--Mark Cupitt 09:45, 12 May 2014 (PHT)

Missing Binary

binary/v8.3.9/win32/postgresql-8.3.9-1.zip can't be found on the dozen or so mirrors I checked. The earliest I can find on the ftp site is 8.3.10. Is it specifically 8.3.9 that's required, or will any later version also suit? Niemand 14:34, 22 October 2010 (BST)

Feature Request

Hi! Yes, I've seen the note "For asking support questions, other Contact channels may be better", but I couldn't find a better channel; osm2pgsql seems not to be mentioned at the page. So I'm going to try it here at the discussion page...
Problem: Using a small virtual server, RAM is rare and CPU time is rare too, of course. So I have decided not to import a whole planet or continent file but small country files instead. osm2pgsql has the -a option to append country by country to the database. So far it works fine! :-)
But - every time I try to import an .osm country file which shares some points or ways with another .osm file, the program osm2pgsql stops converting the data due to a constraint violation of the osm database in Postgre. Is there any possibility to suppress this error message so that osm2pgsql could proceed with its work? It wouldn't matter if some points or ways at the border between these two countries got lost, as I do not need them: rendering is not required.
Does anybody have an idea what to do? --Gypakk 12:45, 4 July 2010 (UTC)

Suggestion: Put each Country into a separate database, then dump and restore to a common database and ignore constraint errors on the load
--Mark Cupitt 09:45, 12 May 2014 (PHT)
An alternative is to use something like Osmosis to merge the OSM files together first. Smsm1 (talk) 11:09, 20 May 2014 (UTC)

MacOSX removal from Homebrew

osm2pgsql has been removed from Homebrew on Mac OS X due to the formula that was there, was a head only formula and didn't build any more. The suggestion being that upstream needs to tag stable releases for reinstatement. As homebrew is the easy way to install software on Mac OS X, it may be worth adding upstream tags/versions to facilitate this.

https://github.com/mxcl/homebrew/issues/14383#commit-ref-2602faf

Smsm1 (talk) 16:15, 31 January 2013 (UTC)