WASAC/vt

Bug in pipe length by year

JinIgarashi opened this issue · 1 comments

It appears only "20" without actual value in popup.

https://rural.water-gis.com/#11.89/-1.9535/30.36818

image

I just checked vectortiles by QGIS, and data is no problem. All of pipe length data is inside vectortiles.

image

The result of the following SQL is also OK.

vt/config.js

Lines 491 to 527 in 53d37ba

pipeline_year as (
SELECT
z.wss_id,
CASE WHEN z.pipe_length_lt_5_years IS NULL THEN '' ELSE '<=5year: ' || z.pipe_length_lt_5_years || E' m\n' END ||
CASE WHEN z.pipe_length_lt_10_years IS NULL THEN '' ELSE '<=10year: ' || z.pipe_length_lt_10_years || E' m\n' END ||
CASE WHEN z.pipe_length_lt_15_years IS NULL THEN '' ELSE '<=15year: ' || z.pipe_length_lt_15_years || E' m\n' END ||
CASE WHEN z.pipe_length_lt_20_years IS NULL THEN '' ELSE '<=20year: ' || z.pipe_length_lt_20_years || E' m\n' END ||
CASE WHEN z.pipe_length_gt_20_years IS NULL THEN '' ELSE '20<year: ' || z.pipe_length_gt_20_years || E' m\n' END ||
CASE WHEN z.pipe_length_unknown_years IS NULL THEN '' ELSE 'Unknown: ' || z.pipe_length_unknown_years || E' m\n' END as pipe_length
FROM(
SELECT
y.wss_id,
SUM(CASE WHEN y.diff_const_year BETWEEN 0 AND 5 THEN round(pipe_length,2) END) as pipe_length_lt_5_years,
SUM(CASE WHEN y.diff_const_year BETWEEN 6 AND 10 THEN round(pipe_length,2) END) as pipe_length_lt_10_years,
SUM(CASE WHEN y.diff_const_year BETWEEN 11 AND 15 THEN round(pipe_length,2) END) as pipe_length_lt_15_years,
SUM(CASE WHEN y.diff_const_year BETWEEN 16 AND 20 THEN round(pipe_length,2) END) as pipe_length_lt_20_years,
SUM(CASE WHEN y.diff_const_year > 20 THEN round(pipe_length,2) END) as pipe_length_gt_20_years,
SUM(CASE WHEN y.diff_const_year IS NULL THEN round(pipe_length,2) END) as pipe_length_unknown_years
FROM (
SELECT
x.wss_id,
x.diff_const_year,
sum(x.pipe_length) as pipe_length
FROM (
SELECT
pipeline.wss_id,
cast(to_char(current_timestamp, 'YYYY') as integer) - COALESCE(pipeline.rehabilitation_year, pipeline.construction_year) as diff_const_year,
cast(ST_LENGTH(ST_TRANSFORM(pipeline.geom, 32736)) as numeric) as pipe_length
FROM pipeline
INNER JOIN wss ON pipeline.wss_id = wss.wss_id
) x
GROUP BY
x.wss_id,
x.diff_const_year) y
GROUP BY
y.wss_id
)z

I am not very sure why all of text can't appear in popup. But I suspect it is matter of mapbox-gl-popup plugin.