Replace UNION with WHERE

pull/65/head
Lukas Martinelli 2015-11-04 20:30:52 +01:00
rodzic 141f82de7e
commit 317d68df0f
1 zmienionych plików z 50 dodań i 98 usunięć

Wyświetl plik

@ -658,70 +658,42 @@ Layer:
coalesce(name, name_de) AS name_de,
coalesce(name, name_ru) AS name_ru,
coalesce(name, name_zh) AS name_zh
FROM (
SELECT geometry, osm_id, area,
name, name_en, name_es, name_fr, name_de, name_ru, name_zh
FROM osm_water_polygons
WHERE area >= 5000000000
AND z(!scale_denominator!) >= 5
AND geometry && !bbox!
UNION ALL
SELECT geometry, osm_id, area,
name, name_en, name_es, name_fr, name_de, name_ru, name_zh
FROM osm_water_polygons
WHERE area < 5000000000 AND area >= 1500000000
AND z(!scale_denominator!) >= 5
AND geometry && !bbox!
UNION ALL
SELECT geometry, osm_id, area,
name, name_en, name_es, name_fr, name_de, name_ru, name_zh
FROM osm_water_polygons
WHERE area < 1500000000 AND area >= 500000000
AND z(!scale_denominator!) >= 8
AND geometry && !bbox!
UNION ALL
SELECT geometry, osm_id, area
name, name_en, name_es, name_fr, name_de, name_ru, name_zh
FROM osm_water_polygons
WHERE area < 500000000 AND area >= 100000000
AND z(!scale_denominator!) >= 9
AND geometry && !bbox!
UNION ALL
SELECT geometry, osm_id, area,
name, name_en, name_es, name_fr, name_de, name_ru, name_zh
FROM osm_water_polygons
WHERE area < 100000000 AND area >= 40000000
AND z(!scale_denominator!) >= 10
AND geometry && !bbox!
UNION ALL
SELECT geometry, osm_id, area,
name, name_en, name_es, name_fr, name_de, name_ru, name_zh
FROM osm_water_polygons
WHERE area < 40000000 AND area >= 20000000
AND z(!scale_denominator!) >= 11
AND geometry && !bbox!
UNION ALL
SELECT geometry, osm_id, area
name, name_en, name_es, name_fr, name_de, name_ru, name_zh
FROM osm_water_polygons
WHERE area < 20000000 AND area >= 10000000
AND z(!scale_denominator!) >= 12
AND geometry && !bbox!
UNION ALL
SELECT geometry, osm_id, area
name, name_en, name_es, name_fr, name_de, name_ru, name_zh
FROM osm_water_polygons
WHERE area < 10000000 AND area >= 5000000
AND z(!scale_denominator!) >= 13
AND geometry && !bbox!
UNION ALL
SELECT geometry, osm_id, area
name, name_en, name_es, name_fr, name_de, name_ru, name_zh
FROM osm_water_polygons
WHERE area < 5000000 AND area >= 1000000
AND z(!scale_denominator!) >= 14
AND geometry && !bbox!
FROM osm_water_polygons
WHERE geometry && !bbox! AND
(
(
area >= 5000000000
AND z(!scale_denominator!) >= 5
)
OR (
area < 1500000000 AND area >= 500000000
AND z(!scale_denominator!) >= 8
)
OR (
area < 500000000 AND area >= 100000000
AND z(!scale_denominator!) >= 9
)
OR (
area < 100000000 AND area >= 40000000
AND z(!scale_denominator!) >= 10
)
OR (
area < 40000000 AND area >= 20000000
AND z(!scale_denominator!) >= 11
)
OR (
area < 20000000 AND area >= 10000000
AND z(!scale_denominator!) >= 12
)
OR (
area < 10000000 AND area >= 5000000
AND z(!scale_denominator!) >= 13
)
OR (
area < 5000000 AND area >= 1000000
AND z(!scale_denominator!) >= 14
)
)
) AS data
type: postgis
user: osm
@ -904,42 +876,22 @@ Layer:
coalesce(name, name_fr) as name_fr,
coalesce(name, name_ru) AS name_ru,
coalesce(name, name_zh) AS name_zh,
type, type as class
type, type as class
FROM osm_water_lines
WHERE type in ('river', 'canal')
AND z(!scale_denominator!) >= 8
AND linelabel(z(!scale_denominator!), name, geometry)
AND geometry && !bbox!
UNION ALL
SELECT geometry, osm_id,
name,
coalesce(name, name_de) as name_de,
coalesce(name, name_en) as name_en,
coalesce(name, name_es) as name_es,
coalesce(name, name_fr) as name_fr,
coalesce(name, name_ru) AS name_ru,
coalesce(name, name_zh) AS name_zh,
type, type as class
FROM osm_water_lines
WHERE type in ('stream', 'stream_intermittent')
AND z(!scale_denominator!) >= 13
AND linelabel(z(!scale_denominator!), name, geometry)
AND geometry && !bbox!
UNION ALL
SELECT geometry, osm_id,
name,
coalesce(name, name_de) as name_de,
coalesce(name, name_en) as name_en,
coalesce(name, name_es) as name_es,
coalesce(name, name_fr) as name_fr,
coalesce(name, name_ru) AS name_ru,
coalesce(name, name_zh) AS name_zh,
type, type as class
FROM osm_water_lines
WHERE type in ('drain', 'ditch')
AND z(!scale_denominator!) >= 15
AND linelabel(z(!scale_denominator!), name, geometry)
AND geometry && !bbox!
WHERE geometry && !bbox! AND (
(
type in ('river', 'canal')
AND z(!scale_denominator!) >= 8
AND linelabel(z(!scale_denominator!), name, geometry)
AND geometry && !bbox!
)
OR (
type in ('stream', 'stream_intermittent')
AND z(!scale_denominator!) >= 13
AND linelabel(z(!scale_denominator!), name, geometry)
AND geometry && !bbox!
)
)
) AS data
type: postgis
user: osm