Talk:Mapnik

From OpenStreetMap Wiki
Jump to: navigation, search

Ubuntu Edgy file paths

I had a little trouble getting some things to work as Ubuntu uses some slightly different paths for postgresql 8.1 than I was expecting.

The mentioned 'liblwgeom.so.1.1' file actually appeared under as /usr/lib/postgresql/8.1/lib/liblwgeom.so.1.1 once I installed the postgres8.1-postgis package.

Higgy 16:36, 24 November 2006 (UTC)

Problem with libosst on debian

In the config.log I found the following error message:

/usr/include/boost/config/requires_threads.hpp:47:5: #error "Compiler threading support is not turned on. Pleas

e set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw 32)"

I had to add:

env.Append(CXXFLAGS = '-pthread')

before the:


BOOST_LIBSHEADERS = [
   ['thread', 'boost/thread/mutex.hpp', True],
   ['filesystem', 'boost/filesystem/operations.hpp', True],
   ['regex', 'boost/regex.hpp', True],
   ['program_options', 'boost/program_options.hpp', False]
]

In the mapnik/SConstruct file to configure the project.

Afterwards I get an errormessage on: that the file boost/ptr_container/ptr_vector.hpp is not found. Sven Anders 18:31, 24 November 2006 (UTC)

A few comments, and an error message (resolved)

Resolved
I managed to get through the whole process. I had to install this or that package along the way and change some paths, but they were easily found. Places where one might get easily stuck are the following:
On kubuntu edgy, I had to specify some more scons paths, especially GDAL
python scons/scons.py GDAL_LIBS=/usr/share/gdal/ BOOST_INCLUDES=/usr/include/boost/ BOOST_LIBS=/usr/lib/ install

and softlink some libraries, e.g.

libboost_thread-gcc-mt-1_33_1.so

to

libboost_thread-mt.so
The sanitizer compiles gracefully using the line
gcc UTF8sanitizer.c -o utf8sanitizer

while the makefile does not.

And finally I am stuck.

I managed to install and test the mapnik demo. I sanitized my osm file (not planet.osm, but a smaller one). I installed the postgres database, and I assumed that DBNAME remains the same during the whole site. Whether as the user with full access rights, or as user postgres, the line

psql -U USER < osm.sql > insert.log

results in the following:

DROP TABLE
CREATE TABLE
                 addgeometrycolumn
------------------------------------------------------
public.planet_osm.way SRID:4326 TYPE:GEOMETRY DIMS:2
(1 row)
BEGIN
INSERT 0 1
(repeated)
INSERT 0 1
ERROR:  parse error - invalid geometry
CONTEXT:  SQL function "geomfromtext" statement 1
ERROR:  current transaction is aborted, commands ignored until end of transaction block
(repeated)
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ROLLBACK
VACUUM

Is there any way how I might easily debug the file, or find out what is wrong? I am not that proficient with the Postgresql utilities, so obvious spoilers might help. Thanks in advance, -- Relet 18:54, 18 May 2007 (BST)

Where do you get that osm.sql from? The current osm2pgsql (in svn: osm/applications/utils/export/osm2pgsql/) doesn't produce any SQL files anymore as it talks directly to the database. Maybe you could try that. BTW, your postgres setup seems to be ok, it's just complaining about the data you feed it. --GabrielEbner 19:51, 18 May 2007 (BST)
Thanks a lot, that helped. Above, I used osm2pgsql.py in utils/renderer/mapnik/ as mentioned in the section getting planet.osm in the database, creating osm.sql as its output. Now, let's see into that Mapnik tutorial. :) -- Relet 00:59, 19 May 2007 (BST)

psql problems with Gentoo

I have dev-db/postgresql-8.0.15 and dev-db/postgis-1.3.1. I think this is the same as postgresql-postgis. Now doing according the manual I get:

$ psql -d gis -f /usr/share/postgresql/contrib/lwpostgis.sql 
...
psql:/usr/share/postgresql/contrib/lwpostgis.sql:6455: ERROR:  current transaction is aborted, commands ignored until end of transaction block
psql:/usr/share/postgresql/contrib/lwpostgis.sql:6460: ERROR:  current transaction is aborted, commands ignored until end of transaction block
psql:/usr/share/postgresql/contrib/lwpostgis.sql:6465: ERROR:  current transaction is aborted, commands ignored until end of transaction block
ROLLBACK

and

$ echo "ALTER TABLE geometry_columns OWNER TO username; ALTER TABLE spatial_ref_sys OWNER TO dheath;"  | psql -d gis
ERROR:  relation "geometry_columns" does not exist
ERROR:  relation "spatial_ref_sys" does not exist
$

Running Mapnik

There should be a section on how to actually launch Mapnik and use it to generate tiles. I (Dshpak) am willing to write it, and will do so once I have everything up and running. For now, I'll keep some notes here (to be eventually merged into the article):

  • The generate_tiles.py script can be used to call Mapnik
  • Bounding boxes are defined at the bottom of this script
  • This script requires the Python Imaging Library (aka PIL) (dev-python/imaging in Gentoo)
  • This script has some hard-coded paths
    • The config file must be in ~/svn.openstreetmap.org/utils/mapnik/osm.xml - Not any more: Set by environment variables.
    • The output goes to ~/osm/tiles - Not any more: Set by environment variables.
  • There appear to be multiple sets of database connection data in the osm.xml file.

Tweaking of rendering settings

Where do I suggest tweakings for the rendering (as used in The Slippy Map)? For example, the motorway_link, trunk_link, and primary_link tagged roads ought to have a narrower rendering than the motorway, trunk, and primary tagged roads. --Seav 12:51, 7 April 2008 (BST)

Problems

Is there a problem with putting motorways under non-motorways? - from Talk:Layer

It works fine when a motorway is depressed and something else crosses over. But when a bridge crosses over an elevated motorway, it doesn't seem to want to put the bridge on top. See the Manhattan Bridge - strangely the pedestrian path works but the roadways and cycleway don't. --NE2 20:46, 13 December 2009 (UTC)

It's question to Mapnik, because on Osmarender work good. --Canabis 09:37, 15 December 2010 (UTC)

Currently – as far as I know – Mapnik uses long-winded definitions in its parameter file osm.xml to define the sequences of different bridge layers. Maybe it would be better to program these layer things into the code than trying to solve the problem with tons of parameters. Don't get me wrong, I am quite a fan of this Renderer. But this seems to be a very unfortunate solution. --Marqqs 11:01, 15 December 2010 (UTC)

World boundaries not working

The urls for getting the WorldBoundaries don't work any more, i can't find new ones. The old is

http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/

Ciprian

Download required data

Wow, this page and associated ones have improved greatly recently - thanks !

Couple of issues remain, mainly related to naturalearth's fiddling with file names, in particular, they have prepended 'ne_' to the admin_0_boundry files. So now the little block giving the command to untar/unzip is wrong and the resulting files after unzipping have the wrong name. Unfortunately, its not just a mv problem, the files themselves have dependencies internally on their collective names. Here is my solution, I am sure someone can do a better.

unzip ne_110m_admin_0_boundary_lines_land.zip -d world_boundaries
unzip ne_10m_populated_places.zip -d world_boundaries
cd world_boundaries
ln -s ne_110m_admin_0_boundary_lines_land.shp 110m_admin_0_boundary_lines_land.shp
ln -s ne_110m_admin_0_boundary_lines_land.dbf 110m_admin_0_boundary_lines_land.dbf

If this is all running on a desktop, I would also suggest that the Postgres user be yourself with a blank password accessible only via localhost. This is hinted at in various places but not clear. This is reasonably safe (on a personal computer) and heaps easier. Now the command to generate osm.xml for instance is just -

./generate_xml.py --host localhost  --dbname gis --symbols ./symbols/ --world_boundaries ./world_boundaries/ --accept-none

Might let these comments sit for awhile and if no one object, I will migrate them to main page.

Finally, is there anywhere, perhaps on someones notebook, a user guide for OSM.XML ? I have been fiddling with it to achieve some different looks I's like to suggest for the slippery map but run into an issue ....

--Davo 04:21, 22 December 2012 (UTC)

Highway concurrencies could be handled better

The convention I've seen on maps for highways with more than one designation (for example, when US 97 overlaps with I 90 in Washington State) is to use separate shields for each designation and cycle among them as you go along the road. Could Mapnik implement this by using a tag like "ref:n=a", where n is an integer and a is a particular highway designation? -- DENelson83 (talk) 09:09, 13 February 2013 (UTC)

Info seriously out of date - update to carto era

The following list is copied from this github issue September 2013:

  • "generate_tiles" python scripts no longer exist, after transition to carto
  • Mapnik 2.0 won't work
  • It contains stuff from postgres 8.1
  • it ignores carto installation
  • It uses a mix of osm-carto and osm-xml stylesheets
  • That entire section probably doesn't belong on that wiki page, it certainly doesn't help clear up the confusion some people have over what "Mapnik" is

User:Danstowell - 08:30, 9 September 2013

Done. I've followed your last point, with extreme prejudice Gravitystorm (talk) 20:15, 9 November 2013 (UTC)