Skip to content

Commit

Permalink
Changes to materialised view definition to prevent errors on database…
Browse files Browse the repository at this point in the history
…s with WKT CRSs (#1037)

* Changes to materialised view definition to prevent errors on databases with WKT CRSs.

* Make 'epsg:' checks case insensitive.

(cherry picked from commit fb88ea2)
  • Loading branch information
SpacemanPaul committed Jul 30, 2024
1 parent 33d634b commit 5b7f01e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
12 changes: 12 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ System Architecture
.. image:: docs/diagrams/ows_diagram1.9.png
:width: 700

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
---------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 upper(substr(metadata #>> '{crs}', 1, 5)) = 'EPSG:'
),
-- This is eo spatial (Uses ALOS-PALSAR over Africa as a sample product)
eo_corners as
Expand All @@ -45,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
Expand All @@ -62,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,
Expand Down Expand Up @@ -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 upper(substr(metadata #>> '{grid_spatial, projection, spatial_reference}', 1, 5)) = 'EPSG:'
and archived is null

0 comments on commit 5b7f01e

Please sign in to comment.