From 54236c56d5095f18a76fb2c3261a0c46cab5c70c Mon Sep 17 00:00:00 2001 From: Paul Haesler Date: Thu, 18 Jul 2024 12:58:33 +1000 Subject: [PATCH 1/2] Changes to materialised view definition to prevent errors on databases with WKT CRSs. --- README.rst | 12 ++++++++++++ .../create/011_create_new_space_view_raw.sql | 2 ++ 2 files changed, 14 insertions(+) diff --git a/README.rst b/README.rst index b40c3f01..ad1ce85b 100644 --- a/README.rst +++ b/README.rst @@ -38,6 +38,18 @@ Features * Supports WCS versions 1.0.0, 2.0.0 and 2.1.0. * Richly featured styling engine for serving data visualisations via WMS and WMTS. +Known CRS Limitations +--------------------- + +1. ODC datasets with WKT-format CRSs will not work with OWS - data from such datasets + will never be displayed. OWS currently only works with EPSG format CRSs. + +2. Datasets that straddle the anti-meridian or the north or south polar region will + cause issues with the legacy postgres driver. + +These are fundamental limitation of the way OWS works with the postgres ODC index driver. +These limitations will be addressed in v1.9.0, but only for the new ODC postgis index driver. + Community --------- diff --git a/datacube_ows/sql/extent_views/create/011_create_new_space_view_raw.sql b/datacube_ows/sql/extent_views/create/011_create_new_space_view_raw.sql index e0546d07..6233e2ea 100644 --- a/datacube_ows/sql/extent_views/create/011_create_new_space_view_raw.sql +++ b/datacube_ows/sql/extent_views/create/011_create_new_space_view_raw.sql @@ -28,6 +28,7 @@ eo3_ranges as from agdc.dataset where metadata_type_ref in (select id from metadata_lookup where name='eo3') and archived is null + and substr(metadata #>> '{crs}', 1, 5) = 'EPSG:' ), -- This is eo spatial (Uses ALOS-PALSAR over Africa as a sample product) eo_corners as @@ -97,4 +98,5 @@ select id, ) as spatial_extent from agdc.dataset where metadata_type_ref in (select id from metadata_lookup where name like 'eo3_%') + and substr(metadata #>> '{grid_spatial, projection, spatial_reference}', 1, 5) = 'EPSG:' and archived is null From 9a1c1d1d05a5e775a2aa0f10ddd4b9b2f4f4d744 Mon Sep 17 00:00:00 2001 From: Paul Haesler Date: Thu, 18 Jul 2024 13:07:31 +1000 Subject: [PATCH 2/2] Make 'epsg:' checks case insensitive. --- .../create/011_create_new_space_view_raw.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/datacube_ows/sql/extent_views/create/011_create_new_space_view_raw.sql b/datacube_ows/sql/extent_views/create/011_create_new_space_view_raw.sql index 6233e2ea..7b600ef0 100644 --- a/datacube_ows/sql/extent_views/create/011_create_new_space_view_raw.sql +++ b/datacube_ows/sql/extent_views/create/011_create_new_space_view_raw.sql @@ -28,7 +28,7 @@ eo3_ranges as from agdc.dataset where metadata_type_ref in (select id from metadata_lookup where name='eo3') and archived is null - and substr(metadata #>> '{crs}', 1, 5) = 'EPSG:' + and upper(substr(metadata #>> '{crs}', 1, 5)) = 'EPSG:' ), -- This is eo spatial (Uses ALOS-PALSAR over Africa as a sample product) eo_corners as @@ -46,7 +46,7 @@ eo_corners as and archived is null and (metadata #>> '{grid_spatial, projection, valid_data}' is null or - substr(metadata #>> '{grid_spatial, projection, spatial_reference}', 1, 4) <> 'EPSG' + upper(substr(metadata #>> '{grid_spatial, projection, spatial_reference}', 1, 5)) <> 'EPSG:' ) ), eo_geoms as @@ -63,8 +63,8 @@ eo_geoms as from agdc.dataset where metadata_type_ref in (select id from metadata_lookup where name in ('eo','eo_s2_nrt','gqa_eo','eo_plus', 'boku')) and archived is null - and metadata #>> '{grid_spatial, projection, valid_data}' is not null - and substr(metadata #>> '{grid_spatial, projection, spatial_reference}', 1, 5) = 'EPSG:' + and metadata #>> '{grid_spatial, projection, valid_data}' is not null + and upper(substr(metadata #>> '{grid_spatial, projection, spatial_reference}', 1, 5)) = 'EPSG:' ) select id,format('POLYGON(( %s %s, %s %s, %s %s, %s %s, %s %s))', lon_begin, lat_begin, lon_end, lat_begin, lon_end, lat_end, @@ -98,5 +98,5 @@ select id, ) as spatial_extent from agdc.dataset where metadata_type_ref in (select id from metadata_lookup where name like 'eo3_%') - and substr(metadata #>> '{grid_spatial, projection, spatial_reference}', 1, 5) = 'EPSG:' + and upper(substr(metadata #>> '{grid_spatial, projection, spatial_reference}', 1, 5)) = 'EPSG:' and archived is null