NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I installed postgresql, gis and mapnik conform this tutorial: . But i took a different step and instead of downloading the whole world, i downloaded just my country. Now, when i run and tiles) i recieve the following error

./ --dbname gis --user prodeng  --accept-none --password apass --symbols ./symbols/ --world_boundaries ./world_boundaries/
Include files written successfully! Pass the osm.xml file as an argument if you want to serialize a new version or test reading the XML
alexandru@alex-lap:~/.osm/bin/mapnik$ ./ 
PostGIS: SRID warning, using srid=-1
Traceback (most recent call last):
  File "./", line 42, in <module>
RuntimeError: PSQL error:
ERROR:  relation "planet_osm_polygon" does not exist
LINE 4:        from planet_osm_polygon
Full sql was: 'select * from 
      (select way,aeroway,amenity,landuse,leisure,man_made,military,"natural",power,tourism,name,highway,
       case when religion in ('christian','jewish') then religion else 'INT-generic'::text end as religion
       from planet_osm_polygon
       where landuse is not null
          or leisure is not null
          or aeroway in ('apron','aerodrome')
          or amenity in ('parking','university','college','school','hospital','kindergarten','grave_yard')
          or military in ('barracks','danger_area')
          or "natural" in ('field','beach','desert','heath','mud','wood','sand','scrub')
          or power in ('station','sub_station','generator')
          or tourism in ('attraction','camp_site','caravan_site','picnic_site','zoo')
          or highway in ('services','rest_area')
       order by z_order,way_area desc
      ) as leisure
       limit 0'
 (encountered during parsing of layer 'landcover')

asked 19 Oct '11, 13:49

alexz's gravatar image

accept rate: 0%

Ok, then it is osm2pgsql not importing your data. The tutorial says

cd /mnt/bin/osm2pgsql

./osm2pgsql -S --slim -d gis -C 4096 /mnt/planet/planet-latest.osm.bz2

How big is the file you import? It may take 1-2 hours per 100mb of compressed data. The -C 4096 expectes more than 4GB of RAM on your machine.

In my toolchain, I use osm2pgsql --create --database osmdb --username osmuser --prefix planet --slim --cache 1024 -S --hstore D:/Karten/osm/Geofabrik/duesseldorf.osm.bz2

osmdb, osmuser and planet to be modified for your needs.

Could you protocol the output of osm2pgsql?

HTH, ajoessen

permanent link

answered 21 Oct '11, 07:09

ajoessen's gravatar image

accept rate: 9%

edited 21 Oct '11, 07:10

Thanks a lot sir. But i receive errors with that command.

$./osm2pgsql -S --slim -d gis -C 2048 /home/alexandru/.osm/moldova.osm.bz2 --password --user 'prodeng'
osm2pgsql SVN version 0.80.0 (32bit id space)

Password: Using projection SRS 900913 (Spherical Mercator) Setting up table: planet_osm_point NOTICE: table "planet_osm_point" does not exist, skipping NOTICE: table "planet_osm_point_tmp" does not exist, skipping Setting up table: planet_osm_line

(21 Oct '11, 08:29) alexz

some more similar messages, then:

NOTICE:  table "planet_osm_rels" does not exist, skipping
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "planet_osm_rels_pkey" for table "planet_osm_rels"

Reading in file: /home/alexandru/.osm/moldova.osm.bz2 Segmentation fault

(21 Oct '11, 08:30) alexz

Ah, thats the point it stops. According to the _int.sql installed previous is interfering.

(21 Oct '11, 08:42) ajoessen

@ajoessen, yes, i just fixed that by deleting my gis db and recreating it accordingly, with this fix : .

But i still have errors. Please help me to sort it out. Check my previous comments, i've edited them.

(21 Oct '11, 08:56) alexz

The NOTICE: are ok. But the Segmentation fault not. Maybe the file was corrupted while downloading? Can you expand it to moldova.osm without error?

(21 Oct '11, 08:59) ajoessen

Yes, extraction worked fine. I changed my cache space to -C 1024 and it seems to work now. Strange how 2048 didn't worked because i have 3 gb on my pc.

(21 Oct '11, 09:09) alexz

The operating System still needs some memory ;-) Mine (Windows XP) ist satisfied with 500kB.

(21 Oct '11, 09:11) ajoessen

So,import finished with

Stopped table:planet_osm_ways in 67s
Osm2pgsql took 1115s overall

But i still don't succeed in generating tiles...

./ --dbname gis --user=prodeng --accept-none
Include files written successfully! Pass the osm.xml file as an argument if you want to serialize a new version or test reading the XML
alexandru@alex-lap:~/.osm/bin/mapnik$ ./
render_tiles( (-180.0, -90.0, 180.0, 90.0) /home/alexandru/ /home/alexandru/osm/tiles/ 0 5 World )

(21 Oct '11, 09:35) alexz


RuntimeError: Could not load map file '/home/alexandru/': File does not exist

(21 Oct '11, 09:39) alexz

slowly getting ahead ;-) I usually make a copy of and change the parameters within that file, found at the end. render_tiles may suppress the error messgaes. You can try to produce a single picture for testing the installation.

(21 Oct '11, 09:46) ajoessen

OH HEY! works! I needed to supply a pass for db user prodeng at for it to work.
Unfortunately doesn't work yet. :(

(21 Oct '11, 09:48) alexz

Sounds good. In the, change the NUM_THREADS = 4 to NUM_THREADS = 1 for a try.

(21 Oct '11, 09:53) ajoessen

Nope, that doesn't change anything. Are you sure this may be the cause for now? it says file not found though.

EDIT: where is the xml generated anyway?

Btw, is potlatch and gis db somehow connected? Because i've stumbled on an interesting change. Please visit this topic for relevancy:

(21 Oct '11, 10:02) alexz

generate_xml creates a few in the inc directory. For rendering, you want to use osm_local.xml? Normally, osm.xml in the same directory as is used. You can edit that in the

if name == "main": home = 'D:/' try: mapfile = "osm.xml" except KeyError: mapfile = home + "/" try: tile_dir = 'D:/Tiles/myMapnik/'

(21 Oct '11, 10:18) ajoessen

Why should i change that, i don't get it. Btw, my text is different:

if name == "main": home = os.environ['HOME'] try: mapfile = os.environ['MAPNIK_MAP_FILE'] except KeyError: mapfile = home + "/" try: tile_dir = os.environ['MAPNIK_TILE_DIR'] except KeyError: tile_dir = home + "/osm/tiles/" if not tile_dir.endswith('/'): tile_dir = tile_dir + '/'

What should i change it to? BTW, echo $MAPNIK_MAP_FILE returns nothing. Is it ok?

(21 Oct '11, 10:31) alexz

Change the mapfile = to the local place and file osm.xml you want to use for rendering. The osm-local.xml does not seem to exist in the right place.

(21 Oct '11, 10:37) ajoessen

Cool. It works now. THough i get a lot of "unknown: empty tile" messages. Hope it's ok.

Btw, where are these tiles going to be used? Can i see them in JOSM? Will i get something more if i'll use then for my osm server (assuming it doesn't).

(21 Oct '11, 10:55) alexz

What do you expect when you import only moldava and render the hole world from -180° to +180°? Most of the tiles must be empty! To see them, you can set up a html-page with openlayers. My wiki-Page is only in German, but perhaps useful for you:

You have to change the path for the tiles from to your local file system, or setup an apache server to use http://localhost For your potlatch2 problem, I cant help you. I only use josm, but with the original osm servers.

(21 Oct '11, 11:05) ajoessen

So then you download the xml from, make changes and then... what? upload the changes to your osm db / gis db / ? Just curious :)

(21 Oct '11, 11:43) alexz

The Postgis database is only useful for rendering with mapnik. Osm2pgsql does a bit preprocessing to change route and multipolygon relations to geometry types that mapnik can understand.

A database for editing must have a different database scheme, dealing with changesets and version history of nodes, ways and relations. Rails Port is the software and database behind that.

I make my edits with josm on the servers, and take a copy of my local area every month from Geofabrik to render my area. Downloading all the tiles from is causing too much traffic on the tile servers.

(21 Oct '11, 12:05) ajoessen

I tried reading it a couple of times but still not sure if i understand. As far as i know, you can download the map data from and then begin to edit it. THen you submit and upload the changes with your account. If you need to see the map changed you go to so how does Geofabrik fits in all this? (i don't know what's geofabrik).

(21 Oct '11, 13:10) alexz

Geofabrik by Frederik Ramm offers the regional extracts (as cloudemade does, but also smaller extracts for my country).

To see my changes, i visit, yes. But I use my own database to make transparent overlays for cycle and hiking routes, bus services, height contour data and borders. These I only use locally in the same way you use the little blue-white "+" on the right of And I can take them on my mobile device without Internet access.

(21 Oct '11, 13:18) ajoessen

Sorry, but that facebook stuff is not my world. You can contact me over my osm profile:

(24 Oct '11, 07:17) ajoessen
showing 5 of 23 show 18 more comments

Please give us access to your xml file produced at the step 1 to inspect it.

Have you imported the data with the same options (dbname, user) than in your given command?

The best way is to look at your DB with a client to see if the table is already there. Can you do this?

permanent link

answered 19 Oct '11, 16:35

NicolasDumoulin's gravatar image

accept rate: 13%

1.Which xml file? Where is it located? What does it represent? I'm new to osm and still trying to figure out how everything works.

(19 Oct '11, 17:10) alexz

2.Different user? No, i don't think so. I used user prodeng. I hope this following table gives some clarity...

Database | user | etc|etc|
     gis           | prodeng       | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
     openstreetmap | openstreetmap | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
     osm           | openstreetmap | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
     osm_test      | openstreetmap | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
     postgres      | postgres      | UTF8     | en_US.UTF-8 | en_US.UTF-8 |

(19 Oct '11, 17:11) alexz

3.What table are we looking for?
alt text

(19 Oct '11, 17:12) alexz
  1. I was talking about the osm.xml that is outputed by

  2. On the bottom of your screenshot, there is a node "Tables", check that you have the table "planet_osm_polygon" below

  3. Can you precise the country you have downloaded?

(20 Oct '11, 08:42) NicolasDumoulin
  1. THat file has a lot of text! I don't think i can copy paste it here.
  2. At the bottom of my screenshot are 2 table and they are both visible. But in the pg_catalog, with 42 table, there is no such thing as planet_osm_polygon.
  3. Moldova.
(20 Oct '11, 14:55) alexz
(20 Oct '11, 14:58) Richard ♦

here we go. This is osm.xml from my mapnik folder.

Btw, i can't generate tiles though i can generate the image.

(21 Oct '11, 10:11) alexz
showing 5 of 7 show 2 more comments

The tables-Section usually holds 9 Entrys: the two shown, and planet_osm_line/nodes/point/polygon/rels/roads and ways. Maybe you should add --prefix planet_osm when importing with osm2pgsql, or look for error messages at this step.

In the tutorial, look at the section Setup PostGIS for OSM

sudo -u postgres -i

createuser prodeng

createdb -E UTF8 -O prodeng gis

createlang plpgsql gis


psql -f /usr/share/postgresql/8.4/contrib/postgis.sql -d gis

echo "ALTER TABLE geometry_columns OWNER TO prodeng; ALTER TABLE spatial_ref_sys OWNER TO prodeng;" | psql -d gis

psql -f /usr/share/postgresql/8.4/contrib/_int.sql -d gis

psql -f /mnt/bin/osm2pgsql/900913.sql -d gis

are the sql-files in the place where you call them? Otherwise the database is not ready for import.

HTH, ajoessen

permanent link

answered 20 Oct '11, 14:04

ajoessen's gravatar image

accept rate: 9%

edited 20 Oct '11, 14:10

Yes, i think everything was done by the tutorial. The files where in place, too.

(20 Oct '11, 14:59) alexz

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 19 Oct '11, 13:49

question was seen: 19,624 times

last updated: 24 Oct '11, 07:17

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum