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

I already rendered tram and rail lines, but i have problem render bus routes. I use this script to render rail lines:

#!/usr/bin/env python import mapnik stylesheet = 'schema.xml' image = 'output.png' m = mapnik.Map(4000,2671) mapnik.load_map(m, stylesheet) m.zoom_all() mapnik.render_to_file(m, image)

and this scheme:

<?xml version="1.0" encoding="utf-8"?> <Map background-color="white" srs="+proj=latlong +datum=WGS84"> <Style name="rail"> <Rule> <Filter>[railway] = 'rail' </Filter> <LineSymbolizer stroke="black" stroke-width="1"/> </Rule> </Style> <Layer name="rails" status="on" srs="+proj=latlong +datum=WGS84"> <StyleName>rail </StyleName> <Datasource> <Parameter name="type">osm </Parameter> <Parameter name="file">map.osm </Parameter> </Datasource> </Layer> </Map>

To render tram lines I only changed filter to [railway] = 'tram'. I tried different filters to render bus routes, but nothing worked. I want only black lines 1pixel wide on white background. How can I do it?

Edit: I have rendered bus routes from postgis database. I imported the map.osm using osm2pgsl. And changed Datasource in schema.xml. The problem is different aspect ratio. This happen when i overlap the images (clipped overlaping images). Red - tram, azur - bus. Bus image has white border on left and right side.

Edit2: Ratio problem solved, I have bad srs projection in layer

asked 22 Mar '13, 23:54

lived's gravatar image

lived
21113
accept rate: 0%

edited 24 Mar '13, 13:23


In a standard osm2pgsql-created database, bus routes will not be in the database - the roads making up the bus routes certainly are, but the information which bus route, if any, they belong to, isn't. There was a question about route relations on the "talk" mailing list recently where a similar question was asked.

Showing the bus routes is much more difficult than showing the railways or trams in your case because you're doing something conceptually different. In your example you are not showing railway or tram lines, you are showing railway or tram tracks - these are easy to match. If you wanted to show tram lines (as in "tram #15 uses this piece of track") then you'd be looking at the same problem that you have with bus routes.

permanent link

answered 23 Mar '13, 19:44

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

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:

×710
×440
×341
×179
×84

question asked: 22 Mar '13, 23:54

question was seen: 9,214 times

last updated: 24 Mar '13, 13:23

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