mirror of
https://github.com/xbgmsharp/postgsail.git
synced 2025-09-17 11:17:46 +00:00
Ensure moorages view and function have a valid geographic point
This commit is contained in:
@@ -327,6 +327,7 @@ CREATE FUNCTION api.export_moorages_geojson_fn(OUT geojson JSONB) RETURNS JSONB
|
|||||||
EXTRACT(DAY FROM justify_hours ( stay_duration )) AS Total_Stay,
|
EXTRACT(DAY FROM justify_hours ( stay_duration )) AS Total_Stay,
|
||||||
geog
|
geog
|
||||||
FROM api.moorages
|
FROM api.moorages
|
||||||
|
WHERE geog IS NOT NULL
|
||||||
) AS m
|
) AS m
|
||||||
)
|
)
|
||||||
) INTO geojson;
|
) INTO geojson;
|
||||||
@@ -372,7 +373,8 @@ CREATE FUNCTION api.export_moorages_gpx_fn() RETURNS pg_catalog.xml AS $export_m
|
|||||||
xmlelement(name "opencpn:scale_min_max", xmlattributes(true as UseScale, 30000 as ScaleMin, 0 as ScaleMax)
|
xmlelement(name "opencpn:scale_min_max", xmlattributes(true as UseScale, 30000 as ScaleMin, 0 as ScaleMax)
|
||||||
))))
|
))))
|
||||||
)::pg_catalog.xml
|
)::pg_catalog.xml
|
||||||
FROM api.moorages m;
|
FROM api.moorages m
|
||||||
|
WHERE geog IS NOT NULL;
|
||||||
END;
|
END;
|
||||||
$export_moorages_gpx$ LANGUAGE plpgsql;
|
$export_moorages_gpx$ LANGUAGE plpgsql;
|
||||||
-- Description
|
-- Description
|
||||||
|
@@ -194,6 +194,7 @@ CREATE OR REPLACE VIEW api.moorages_view WITH (security_invoker=true,security_ba
|
|||||||
FROM api.moorages m, api.stays_at sa
|
FROM api.moorages m, api.stays_at sa
|
||||||
WHERE m.name is not null
|
WHERE m.name is not null
|
||||||
AND m.stay_code = sa.stay_code
|
AND m.stay_code = sa.stay_code
|
||||||
|
AND geog IS NOT NULL
|
||||||
GROUP BY m.id,m.name,sa.description,m.stay_duration,m.reference_count,m.geog,sa.stay_code
|
GROUP BY m.id,m.name,sa.description,m.stay_duration,m.reference_count,m.geog,sa.stay_code
|
||||||
-- ORDER BY 4 DESC;
|
-- ORDER BY 4 DESC;
|
||||||
ORDER BY m.reference_count DESC;
|
ORDER BY m.reference_count DESC;
|
||||||
@@ -213,7 +214,8 @@ CREATE OR REPLACE VIEW api.moorage_view WITH (security_invoker=true,security_bar
|
|||||||
m.notes
|
m.notes
|
||||||
-- m.geog
|
-- m.geog
|
||||||
FROM api.moorages m
|
FROM api.moorages m
|
||||||
WHERE m.name IS NOT NULL;
|
WHERE m.name IS NOT NULL
|
||||||
|
AND geog IS NOT NULL;
|
||||||
-- Description
|
-- Description
|
||||||
COMMENT ON VIEW
|
COMMENT ON VIEW
|
||||||
api.moorage_view
|
api.moorage_view
|
||||||
|
Reference in New Issue
Block a user