gravitystorm/openstreetmap-carto — pull request #217 by pnorman (2013-10-07 11:48:25+00:00)
Title: Add a building is null condition to the landcover layer

Adds a `building IS NULL` to the landcover SQL.

The motivation is that this allows substantial performance increases with the right indexes and that landcover is not buildings, as well as fixing some subtle styling oddities.

The performance gain is at least +3.7% over f5ef47835e435cde9353f65b95953f45818092c2 with the greatest gains shown at high zooms with +5.4% at z18 and +2.8% at z13. A partial index `WHERE building IS NULL` as described in https://github.com/gravitystorm/openstreetmap-carto/issues/207#issuecomment-25689455 was present in all cases.

Buildings are drawn on top of this layer, so there isn't a rendering impact.

### Details on why this doesn't impact rendering ###
The old SQL filtering condition is

```sql
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')
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')
```

This pull just adds `AND building IS NULL` to it.

Additionally, the `CASE` statement in the columns effectively restricts `leisure` to `'swimming_pool', 'playground', 'park', 'recreation_ground', 'common', 'garden', 'golf_course'` and `landuse` to

```
'quarry', 'vineyard', 'orchard', 'cemetery', 'grave_yard', 'residential', 'garages', 'field',
'meadow', 'grass', 'allotments', 'forest', 'farmyard', 'farm', 'farmland', 'recreation_ground',
'conservation', 'village_green', 'retail', 'industrial', 'railway', 'commercial', 'brownfield',
'landfill', 'greenfield', 'construction'
```

I was initially concerned that adding `building IS NULL` would impact rendering of features like `amenity=school`, but this is not so.

It turns out that if there is a building tag, the building is rendered on top of the landuse layer, obscuring it, giving it only a very minor rendering effect around the edges due to anti-aliasing.
As an example, see these two buildings, one `building=yes` `amenity=school` and one a normal `building=yes`

![89786](https://f.cloud.github.com/assets/1190866/1279939/9fda4574-2f44-11e3-9e90-5bf9342cacbd.png)![89785](https://f.cloud.github.com/assets/1190866/1279940/a1a028a6-2f44-11e3-83fe-2ee2b695be89.png)

There is a difference but it is **extremely** subtle. The building fill is also very subtly different.

The same thing will apply to any building - the building polygon will be drawn on top of the landcover polygon