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

Hi, I am trying to get the german mapnik style to work on Ubuntu 12.04 as proposed by the SVN README:

> To deploy this style use the supplied default.style file for
> osm2pgsql and import data using the hstore extension of
> PostgreSQL (--hstore --hstore-match-only switches of osm2pgsql).
>
> To keep the database compatible to the "original" Mapnik style we
> now use views instead of tables. SQL scripts to set up these views
> are supplied in the views directory.

I create my database using sachsen.osm from geofabrik and osm2pgsql from the ppa:kakrueger/openstreetmap (osm2pgsql SVN version 0.81.0 (64bit id space))

osm2pgsql -m -d osm --hstore -W -S /path/to/mapnik-german/views/default.style  mapnik/sachsen.osm

Then I create the views that are supposed to be used by the germany mapnik style:

sudo -u postgres psql osm < mapnik-german/views/view-line.sql
sudo -u postgres psql osm < mapnik-german/views/view-point.sql
sudo -u postgres psql osm < mapnik-german/views/view-polygon.sql
sudo -u postgres psql osm < mapnik-german/views/view-roads.sql

Then I create a new directory "mapnik-de" containing the mapnik-repo. I copy mapnik-german ontop of that (is that the way to go?) and copy all the template files to inc files in mapnik-de/inc-de/. I use mapnik-de as working directory.

Now, when I try to generate my xml file

./generate_xml.py --dbname osm --host 'localhost' --user USERNAME --port 5432 --password 'PASSWORD' --inc inc-de  osm-de.xml > osm-local.xml

I get the following error:

/usr/lib/pymodules/python2.7/mapnik2/__init__.py:27: DeprecationWarning:  mapnik2 module has been deprecated,
        please use 'import mapnik' 
  warnings.warn(msg, DeprecationWarning)
Traceback (most recent call last):
  File "./generate_xml.py", line 204, in <module>
    serialize(template_xml,options)
  File "./generate_xml.py", line 80, in serialize
    mapnik.load_map(m,xml,True)
RuntimeError: Postgis Plugin: PSQL error:
ERROR:  column "wood" does not exist
LINE 1: ...enity,landuse,leisure,man_made,military,"natural",wood,power...
                                                             ^
Full sql was: 'SELECT * FROM (select way,aeroway,amenity,landuse,leisure,man_made,military,"natural",wood,power,tourism,coalesce("name:de",name) as 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','prison')
          or military in ('barracks','danger_area')
          or "natural" in ('field','beach','desert','heath','mud','grassland','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' in Layer at line 381 of 'osm-de.xml'

I am using mapnik 2.1.0 from the ppa:mapnik/v2.1.0

To me it looks like the generated views are not correctly accessed. When I use a custom default.style file with osm2pgsql that contains "wood" and a couple more, then this error does not show and I can create tiles.

I am not used to postgresql or postgis. Maybe I just understood something wrong? I took a look with pgadmin3 and there are the four views and except view_osmde_roads they all contain the column "wood".

asked 29 Dec '12, 14:24

skaiwalker's gravatar image

skaiwalker
6111
accept rate: 0%

edited 29 Dec '12, 14:39


Your Mapnik style is trying to access the tables directly instead of the generated views.

I would assume that your prefix entity in settings.xml.inc is wrong.

It should contain <!ENTITY prefix "view_osmde"> instead of <!ENTITY prefix "planet_osm">

Sven

permanent link

answered 29 Dec '12, 15:40

giggls's gravatar image

giggls
12613
accept rate: 50%

Thanks Sven,
I simply forgot the "--prefix" option in generate_xml.py.

But there is another problem with the database. My generate_xml.py command now looks like this:

./mapnik/generate_xml.py \
 --host 'localhost' \
 --port 5432 \
 --dbname osm \
 --prefix view_osmde \
 --user postgres \
 --password 'USERPWD' \
 --inc /home/USERNAME/osm/mapnik-german/inc-de \
 --world_boundaries /home/USERNAME/osm/mapnik/world_boundaries \
 /home/USERNAME/osm/mapnik-german/osm-de.xml > /home/USERNAME/osm/mapnik-german/osm-local.xml

And it works.

When I run generate_tiles.py, it only generates 0/0/0.png and I get errors like this:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "./mapnik-german/generate_tiles.py", line 115, in loop
    self.render_tile(tile_uri, x, y, z)
  File "./mapnik-german/generate_tiles.py", line 97, in render_tile
    mapnik.render(self.m, im)
RuntimeError: PostGIS: geometry name lookup failed for table 'view_osmde_point'. Please manually provide the 'geometry_field' parameter or add an entry in the geometry_columns for 'view_osmde_point'.

What does that mean? Cheers!

(29 Dec '12, 18:57) skaiwalker

After some googling I found this function "populate_geometry_columns()" and it seemed to do the job:

sudo -u postgres psql -d osm
SELECT populate_geometry_columns();

Creating tiles with german style now works.
Can you please confirm that I did the right thing? I will write up a short Quickstart guide and upload it to the repo.

permanent link

answered 29 Dec '12, 20:10

skaiwalker's gravatar image

skaiwalker
6111
accept rate: 0%

1

I had the same problem and that solved it for me too!

(27 Apr '15, 15:49) milkbread

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×341
×134
×65
×34
×5

question asked: 29 Dec '12, 14:24

question was seen: 8,682 times

last updated: 27 Apr '15, 15:49

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