Page MenuHomePhabricator

Reuse Layer definitions in data.yml
Open, NormalPublic

Description

Every Layer's Datasource in data.yml needs to define dbname, extent, type, and *should* define key_field.

This is repetitive, and we should use one of the mechanisms YAML offers to reduce it.

One way I've done this is

_parts:
  osm2pgsql: &osm2pgsql
    type: postgis
    dbname: "ct"
    srid: 3857
    geometry_field: "way"
    extent: "-20037508,-20037508,20037508,20037508"
Layer:
  - id: water
    geometry: polygon
    description: Water polygons, including oceans
    fields:
      osm_id: ID of the OSM object, if known. Negative for relations
    properties:
      minzoom: 0
      buffer-size: 4
    Datasource:
      <<: *osm2pgsql
      table: |-
        ...

This creates a set of properties which are brought in to each Datasource.

Related: T199814: Don't include empty Datasource properties

Event Timeline

Pnorman created this task.Jul 17 2018, 4:14 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 17 2018, 4:14 PM
Mholloway triaged this task as Normal priority.Jul 19 2018, 5:42 PM