view client/src/components/identify/formatter.js @ 2624:9dbaf69c7a66

Improve geoserver config to better calculate bounding boxes * Disable the use of estimated extents for the postgis storage configuration for geoserver, which is set via the gemma middleware. This way we are able to get better bounding boxes for many layers where the postgis function `ST_EstimatedExtent()` would be far off.
author Bernhard Reiter <bernhard@intevation.de>
date Wed, 13 Mar 2019 16:18:39 +0100
parents 4486ca003b55
children 4063adda3095
line wrap: on
line source

const formatter = {
  all(p) {
    if (p.key === "objnam") p.key = "Name";
    if (p.key === "objname") p.key = "Name";
    if (p.key === "staging_done" || p.key === "fa_critical")
      p.val = p.val ? "yes" : "no";
    if (p.key === "date_info" || p.key === "fa_date_info") {
      p.val = new Date(p.val).toLocaleString();
    }
    return p;
  },
  bottlenecks_geoserver: {
    label: "Bottleneck",
    props: p => {
      if (p.key === "bottleneck_id") p.key = "ID";
      if (p.key === "responsible_country") p.key = "Responsible Country";
      if (p.key === "fa_date_info") p.key = "Fairway Date";
      if (p.key === "fa_critical") p.key = "Fairway Critical";

      // remove certain props
      let propsToRemove = ["nobjnm", "reference_water_levels"];
      if (propsToRemove.indexOf(p.key) !== -1) return null;

      return p;
    }
  },
  fairway_dimensions: {
    label: "Fairway Dimensions"
  },
  waterway_area: {
    label: "Waterway Area"
  },
  distance_marks_geoserver: {
    label: "Distance Mark"
  },
  waterway_axis: {
    label: "Waterway Axis"
  },
  waterway_profiles: {
    label: "Waterway Profile"
  },
  stretches_geoserver: {
    label: "Stretch"
  },
  gauges_geoserver: {
    label: "Gauge"
  }
};

export { formatter };