generalized_tables:

  # etldoc: osm_border_disp_linestring_gen_z2 -> osm_border_disp_linestring_gen_z1
  border_disp_linestring_gen_z1:
    source: border_disp_linestring_gen_z2
    sql_filter: admin_level = 2
    tolerance: ZRES2

  # etldoc: osm_border_disp_linestring_gen_z3 -> osm_border_disp_linestring_gen_z2
  border_disp_linestring_gen_z2:
    source: border_disp_linestring_gen_z3
    sql_filter: admin_level = 2
    tolerance: ZRES3

  # etldoc: osm_border_disp_linestring_gen_z4 -> osm_border_disp_linestring_gen_z3
  border_disp_linestring_gen_z3:
    source: border_disp_linestring_gen_z4
    sql_filter: admin_level = 2
    tolerance: ZRES4

  # etldoc: osm_border_disp_linestring_gen_z5 -> osm_border_disp_linestring_gen_z4
  border_disp_linestring_gen_z4:
    source: border_disp_linestring_gen_z5
    sql_filter: admin_level = 2
    tolerance: ZRES5

  # etldoc: osm_border_disp_linestring_gen_z6 -> osm_border_disp_linestring_gen_z5
  border_disp_linestring_gen_z5:
    source: border_disp_linestring_gen_z6
    sql_filter: admin_level = 2
    tolerance: ZRES6

  # etldoc: osm_border_disp_linestring_gen_z7 -> osm_border_disp_linestring_gen_z6
  border_disp_linestring_gen_z6:
    source: border_disp_linestring_gen_z7
    sql_filter: admin_level = 2
    tolerance: ZRES7

  # etldoc: osm_border_disp_linestring_gen_z8 -> osm_border_disp_linestring_gen_z7
  border_disp_linestring_gen_z7:
    source: border_disp_linestring_gen_z8
    sql_filter: admin_level = 2
    tolerance: ZRES8

  # etldoc: osm_border_disp_linestring_gen_z9 -> osm_border_disp_linestring_gen_z8
  border_disp_linestring_gen_z8:
    source: border_disp_linestring_gen_z9
    sql_filter: admin_level = 2
    tolerance: ZRES9

  # etldoc: osm_border_disp_linestring_gen_z10 -> osm_border_disp_linestring_gen_z9
  border_disp_linestring_gen_z9:
    source: border_disp_linestring_gen_z10
    sql_filter: admin_level = 2
    tolerance: ZRES10

  # etldoc: osm_border_disp_linestring_gen_z11 -> osm_border_disp_linestring_gen_z10
  border_disp_linestring_gen_z10:
    source: border_disp_linestring_gen_z11
    sql_filter: admin_level = 2
    tolerance: ZRES11

  # etldoc: osm_border_disp_linestring_gen_z12 -> osm_border_disp_linestring_gen_z11
  border_disp_linestring_gen_z11:
    source: border_disp_linestring_gen_z12
    sql_filter: admin_level = 2
    tolerance: ZRES12

  # etldoc: osm_border_disp_linestring_gen_z13 -> osm_border_disp_linestring_gen_z12
  border_disp_linestring_gen_z12:
    source: border_disp_linestring_gen_z13
    sql_filter: admin_level = 2
    tolerance: ZRES13

  # etldoc: osm_border_disp_linestring -> osm_border_disp_linestring_gen_z13
  border_disp_linestring_gen_z13:
    source: border_disp_linestring
    sql_filter: admin_level = 2
    tolerance: ZRES14

  # etldoc: osm_border_disp_relation -> osm_border_disp_linestring
  border_disp_linestring:
    source: border_disp_relation
    sql_filter: ST_GeometryType(geometry) = 'ST_LineString'


tables:
  # etldoc: imposm3 -> osm_border_disp_relation
  border_disp_relation:
    type: relation_member
    columns:
    - name: relation_id
      type: id
    - name: osm_id
      type: id
      from_member: true
    - name: geometry
      type: geometry
    - key: name
      name: name
      type: string
    - key: boundary
      name: boundary
      type: string
    - key: admin_level
      name: admin_level
      type: integer
    - key: claimed_by
      name: claimed_by
      type: string
    - key: disputed_by
      name: disputed_by
      type: string
    - key: maritime
      name: maritime
      type: bool
      from_member: true
    mapping:
      type: [boundary]
    filters:
      require:
        #admin_level: ['2']
        admin_level: [__any__]
        claimed_by: [__any__]
