[OSM-dev] Mapnik style broken?

Jon Burgess jburgess777 at googlemail.com
Mon May 14 22:15:56 BST 2007


On Mon, 2007-05-14 at 21:37 +0100, David Earl wrote:
> 
> > -----Original Message-----
> > From: dev-bounces at openstreetmap.org
> > [mailto:dev-bounces at openstreetmap.org]On Behalf Of David Earl
> > Sent: 14 May 2007 21:36
> > To: dev at openstreetmap.org
> > Subject: Re: [OSM-dev] Mapnik style broken?
> > 
> > 
> > > Is setting landuse to layer=-1 a generally acceptable solution?
> > 
> > No. All linear ways should always be rendered on top of areas (within the
> > same layer): (a) there is never any occasion when one wouldn't want to do
> > this, and (b) there are thousands of existing areas which rely on 
> > this. This
> > has been discussed before on the main list.
> 
> OK, sorry, you were talking about area vs area.

The question is still valid but I think the better answer is to extend
what Mapnik already does to determine the z_order of roads.

The equations look something like:

	z_order = 10 * layer

	motorway: z_order += 9
	trunk:    z_order += 8
	primary:  z_order += 7
	secondary z_order += 6
	...

An explicit layer is the biggest contributor to the rendering order
(which it always will be), but certain highway types will get drawn on
top of less important highways. These z_order tweaks are important when
layer= is unset or the highways are in the same layer.

We can do something similar for areas:

	z_order = 10 * layer

	leisure: z_order += 2
	natural: z_order += 1
	landuse: z_order -= 1
	...

Unfortunately the relative rendering priorities for areas is a lot less
easy to guess than those of highways and potentially involves multiple
key/values.

As I mentioed in another email, I think the layering model of mapnik is
currently slightly different to other renderers. I think Mapnik always
draw lines over the top of areas even if the area has a higher layer set
than the line. This is because it renders all polygons, then lines, then
points, then text / symbols (at least this is what I understand, perhaps
Artem can confirm or correct me).

I believe other renders will layer an area(layer=0) over the top of a
road(layer=-1). 

	Jon






More information about the dev mailing list