mirror of
https://github.com/xbgmsharp/postgsail.git
synced 2025-09-17 11:17:46 +00:00
Update api.timelapse_fn, return only logbook with geojson data.
This commit is contained in:
@@ -25,17 +25,20 @@ CREATE OR REPLACE FUNCTION api.timelapse_fn(
|
|||||||
SELECT jsonb_agg(track_geojson->'features') INTO _geojson
|
SELECT jsonb_agg(track_geojson->'features') INTO _geojson
|
||||||
FROM api.logbook
|
FROM api.logbook
|
||||||
WHERE id >= start_log
|
WHERE id >= start_log
|
||||||
AND id <= end_log;
|
AND id <= end_log
|
||||||
|
AND track_geojson IS NOT NULL;
|
||||||
--raise WARNING 'by log _geojson %' , _geojson;
|
--raise WARNING 'by log _geojson %' , _geojson;
|
||||||
ELSIF start_date IS NOT NULL AND public.isdate(start_date::text) AND public.isdate(end_date::text) THEN
|
ELSIF start_date IS NOT NULL AND public.isdate(start_date::text) AND public.isdate(end_date::text) THEN
|
||||||
SELECT jsonb_agg(track_geojson->'features') INTO _geojson
|
SELECT jsonb_agg(track_geojson->'features') INTO _geojson
|
||||||
FROM api.logbook
|
FROM api.logbook
|
||||||
WHERE _from_time >= start_log::TIMESTAMP WITHOUT TIME ZONE
|
WHERE _from_time >= start_log::TIMESTAMP WITHOUT TIME ZONE
|
||||||
AND _to_time <= end_date::TIMESTAMP WITHOUT TIME ZONE + interval '23 hours 59 minutes';
|
AND _to_time <= end_date::TIMESTAMP WITHOUT TIME ZONE + interval '23 hours 59 minutes'
|
||||||
|
AND track_geojson IS NOT NULL;
|
||||||
--raise WARNING 'by date _geojson %' , _geojson;
|
--raise WARNING 'by date _geojson %' , _geojson;
|
||||||
ELSE
|
ELSE
|
||||||
SELECT jsonb_agg(track_geojson->'features') INTO _geojson
|
SELECT jsonb_agg(track_geojson->'features') INTO _geojson
|
||||||
FROM api.logbook;
|
FROM api.logbook
|
||||||
|
WHERE track_geojson IS NOT NULL;
|
||||||
--raise WARNING 'all result _geojson %' , _geojson;
|
--raise WARNING 'all result _geojson %' , _geojson;
|
||||||
END IF;
|
END IF;
|
||||||
-- Return a GeoJSON filter on Point
|
-- Return a GeoJSON filter on Point
|
||||||
|
Reference in New Issue
Block a user