generalized_tables:
  # etldoc: osm_park_polygon_gen_z7 -> osm_park_polygon_gen_z6
  park_polygon_gen_z6:
    source: park_polygon_gen_z7
    sql_filter: area>power(ZRES5,2)
    tolerance: ZRES8

  # etldoc: osm_park_polygon_gen_z8 -> osm_park_polygon_gen_z7
  park_polygon_gen_z7:
    source: park_polygon_gen_z8
    sql_filter: area>power(ZRES6,2)
    tolerance: ZRES8

  # etldoc: osm_park_polygon_gen_z9 -> osm_park_polygon_gen_z8
  park_polygon_gen_z8:
    source: park_polygon_gen_z9
    sql_filter: area>power(ZRES7,2)
    tolerance: ZRES9

  # etldoc: osm_park_polygon_gen_z10 -> osm_park_polygon_gen_z9
  park_polygon_gen_z9:
    source: park_polygon_gen_z10
    sql_filter: area>power(ZRES8,2)
    tolerance: ZRES10

  # etldoc: osm_park_polygon_gen_z11 -> osm_park_polygon_gen_z10
  park_polygon_gen_z10:
    source: park_polygon_gen_z11
    sql_filter: area>power(ZRES9,2)
    tolerance: ZRES11

  # etldoc: osm_park_polygon_gen_z12 -> osm_park_polygon_gen_z11
  park_polygon_gen_z11:
    source: park_polygon_gen_z12
    sql_filter: area>power(ZRES10,2)
    tolerance: ZRES11

  # etldoc: osm_park_polygon_gen_z13 -> osm_park_polygon_gen_z12
  park_polygon_gen_z12:
    source: park_polygon_gen_z13
    sql_filter: area>power(ZRES11,2)
    tolerance: ZRES12

  # etldoc: osm_park_polygon -> osm_park_polygon_gen_z13
  park_polygon_gen_z13:
    source: park_polygon
    sql_filter: area>power(ZRES12,2) AND ST_IsValid(geometry)
    tolerance: ZRES13

tables:

  # etldoc: imposm3 -> osm_park_polygon
  park_polygon:
    type: polygon
    _resolve_wikidata: false
    columns:
    - name: osm_id
      type: id
    - name: geometry
      type: validated_geometry
    - name: name
      key: name
      type: string
    - name: name_en
      key: name:en
      type: string
    - name: name_de
      key: name:de
      type: string
    - name: tags
      type: hstore_tags
    - name: landuse
      key: landuse
      type: string
    - name: leisure
      key: leisure
      type: string
    - name: boundary
      key: boundary
      type: string
    - name: protection_title
      key: protection_title
      type: string
    - name: area
      type: area
    mapping:
      leisure:
      - nature_reserve
      boundary:
      - national_park
      - protected_area
