I try download OSM planet into PostgreSQL database.

I do all steps from instruction http://switch2osm.org/serving-tiles/manually-building-a-tile-server-12-04/

I also modify string "kernel.shmmax"

Now I try download:

osm2pgsql --slim -d gis -C 800 --number-processes 4 planet-latest.osm.pbf

But I have error:

Reading in file: planet-latest.osm.pbf
Processing: Node(2041920k 189.9k/s) Way(199297k 3.39k/s) Relation(47930 14.42/s)osm2pgsql: PolygonBuilder.cpp:261: geos::geomgraph::EdgeRing* geos::operation::overlay::PolygonBuilder::findShell(std::vector<geos::operation::overlay::MinimalEdgeRing*>*): Assertion `shellCount <= 1' failed.

Emergency stop(made a memory dump)

How can I solve this problem?


It is important to know, that the problem is in data. I use planet-latest.osm.pbf 10-Oct-2013 13:29 22G

When I download rostov.osm.bz2 there are no problem.

Which version of libgeos is usefull for me?


Well. It is interesting to know, that I try to download planet-131002.osm.pbf file. I verify md5. It is equal.


I instal the latest version of libgeos. It is 3.3.3-1. Then I try download planet-131002.osm.pbf, and then planet-130614.osm.pb

But I have the same problem.

  • I am having the exact same problem with the planet-latest.osm.pbf from Sept 25 2013. I am also using the guide mentioned. Where can I find rostov.osm.bz2? Is that an entire planet file? Thanks – Joe Y Oct 15 '13 at 11:56
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. – user3461 Oct 15 '13 at 12:23
  • Yes, sorry about that. I really wanted to post a comment, but it ended up an answer. That was not my intent. – Joe Y Oct 15 '13 at 12:35

I had the same problem, and here is how I solved it:

The problem lies in PolygonBuilder.cpp within the libgeos library. The line causing the problem has actually been fixed already, but the fix is not in the current ubuntu/debian repository that is installed via apt-get. Details of the change can be found here.

I downloaded the libgeos from github and built the package from source using their instructions. I then removed the installed version of libgeos-dev using apt-get autoremove. This actually removed a few other dependent packages that I later had to reinstall. (libgdal-dev) The important thing here is to rebuild the osm2pgsql package which links against libgeos library. I also recompiled mapnik, which needed the libgdal-dev library that I previously removed when autoremoving libgeos-dev. This step may or may not be necessary, but I wanted to make sure everything that used libgeos was recompiled. After these steps I got past roadblock.

Overall I wasted a couple weeks of effort since it took so long to load the planet file into the database. (Increasing the memory cache configuration really speeds things up.) I ran this command when importing.

osm2pgsql --silm -d gis -C 28000 --number-processes 8 /tile/planet-latest.osm.bz2


  1. Remove installed version of libgeos-dev

    apt-get remove libgeos-dev

  2. Download and install libgeos from github

  3. Recompile and install osm2pgsql and possibly other packages that use libgeos.

  4. Import the database and wait...

Hopefully this will help you and others.

  • I can see that you wanted to share your experience, and tell us how you solved the problem. Hence I took the liberty of editing it, to structure it like an Answer. – Devdatta Tengshe Oct 16 '13 at 2:57
  • Please delete this answer. I responded too hastily. The process went much further along, but did crash with the same error during the Relation section of loading the data. I have confirmed that the build instructions do not work with the entire planet file. A smaller file such as the North America continent does work. Please delete my answer. I'll crawl back into my hole and wait for a resolution myself. – Joe Y Oct 21 '13 at 14:38
  • You can delete it yourself. Just press 'Delete' link beneath the answer. – Devdatta Tengshe Oct 21 '13 at 15:35
  • I have created a chef-solo app based on switch2osm.org/serving-tiles/… and incorporating the fix suggested by Joe Y. It's a very much work in progress. It's available here: github.com/radekg/osm – radekg Dec 1 '13 at 14:32
  • Jesus! -C 28000 --number-processes 8 !! How much memory have you? – Magno C Apr 5 '17 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.