# [OSM-dev] Mapnik style broken?

Artem Pavlenko artem at mapnik.org
Mon May 14 22:25:51 BST 2007

```On 14 May 2007, at 22:15, Jon Burgess wrote:

> 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).

At the moment, yes polys->lines->points. But we can change this by
storing mixed geometries (as used to be:)
in one big table and using global z_ordering. It will work but we
need well defined rules for how to order features.

Cheers,
Artem

>
> I believe other renders will layer an area(layer=0) over the top of a
>
> 	Jon
>
>
>
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev
>

Artem Pavlenko
http://mapnik.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20070514/d0592b56/attachment.html>
```