Mercurial > gemma
view schema/updates/1006/01.fix-search-only-valid-bottleneck.sql @ 5092:8dc27fc1d05c
Add temporal validity attributes and WMS-T config to bottlenecks layer
Attributes related to data availability and quality still refer to
the current situation.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 24 Mar 2020 12:32:42 +0100 |
parents | b10f210af325 |
children |
line wrap: on
line source
CREATE OR REPLACE FUNCTION search_bottlenecks(search_string text) RETURNS jsonb LANGUAGE plpgsql STABLE PARALLEL SAFE AS $$ DECLARE _result jsonb; BEGIN SELECT COALESCE(json_agg(r),'[]') INTO _result FROM (SELECT objnam AS name, ST_AsGeoJSON(ST_Envelope(area::geometry))::json AS geom, 'bottleneck' AS type FROM waterway.bottlenecks WHERE objnam ILIKE '%' || search_string || '%' AND validity @> now() ORDER BY name) r; RETURN _result; END; $$;