[Geoserver-devel] Problems with WCS 2.0 longitude subsetting in 0-360 referenced coverages

Hi all,

I’m running into some issues with longitude subsetting in WCS2.0 with coverages referenced from 0-360 (GRIB in particular). This can be seen in this ticket.

https://osgeo-org.atlassian.net/browse/GEOT-5372

For starters, there are some small bugs in the WCSEnvelope class, in particular the intersects method. See here:

https://github.com/geoserver/geoserver/blob/f783e52c9099d7cb31cea3f6f0ede77301906446/src/wcs2_0/src/main/java/org/geoserver/wcs2_0/WCSEnvelope.java#L195

There are a couple issues here:

  1. This code assumes that the normalized envelopes are returned in “left-to-right” order, but they are not. eg. 0-360 normalizes to two envelopes, (0,180), (-180,0). Not a big deal, an easy fix.

  2. It is not checking the “other” envelope to see if it crosses the date line. So if the other is (0,360), the intersection becomes simply (0,180). Again, not a big issue.

The bigger issue, as far as I can tell, is normalizing the request bounds in the first place. Is this necessary? WCS2.0 seems to be the only code-path where this is the case. WMS, WCS1.x, etc., none of these seem to normalize the request. So if you request (0,360) the coverage store read ends up for (0,360) at least. This seems correct to me, and it seems to be what the coverage stores support (or at least NetCDF and ImageMosaic).

So what is the correct thing to do here? Should the request bounds be normalized, or should the readers be updated to support the normalized bounds? Or am I missing something else?

Thanks,
Devon

So what is the correct thing to do here?

Read the specification about dateline crossing requests, for starters :wink:

Should the request bounds be normalized, or should the readers be updated to support the normalized bounds? Or am I missing something else?

The specification says that in WCS 2.0 a dateline crossing request must be expressed with the two longitudes within valid range,
and in inverted position, e.g.:

…&subset=Long(150,-150)&subset=Lang(-90,90)

The normalization code is there to handle this case and return multiple envelopes expressed within valid range.

Strictly speaking, asking for Long(0,360) is invalid in WCS 2.0, but if you want you can relax the code to allow that case too,
GeoServer has never played OGC cop (unless the “strict cite conformace” flags are up, that is)

Cheers
Andrea

···

GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.

On Thu, Sep 20, 2018 at 8:17 AM Andrea Aime <andrea.aime@anonymised.com> wrote:

The specification says that in WCS 2.0 a dateline crossing request must be expressed with the two longitudes within valid range,

and in inverted position, e.g.:

Actually searched the WCS 2.0 spec, it does not contain the sentence I remembered, the WCS 1.1 does:

"In a geographic CRS, longitude values are often defined with a finite extent (e.g., from -180
degrees to +180 degrees). The minimum and maximum longitude limits define a single line
(on the ellipsoid, sphere, or cylinder), known as the antimeridian, across which longitude
values are discontinuous: as this line is crossed, longitude changes abruptly (e.g., going West
from a little more than -180 degrees to a little less than +180 degrees). This necessitates an
“extended” interpretation of the Bounding Box definition:

A Bounding Box defined in a geographic CRS (or a WGS84BoundingBox)
whose LowerCorner longitude is greater than that of its UpperCorner shall
describe a region that crosses the longitude discontinuity."

The commit that introduced the current behavior, 4 years ago, indeed refers to borrowing it from the
previous specs:

https://osgeo-org.atlassian.net/browse/GEOS-6622

I’ve inquired on the WCS 2.0 SWG about it, will let you know.

Cheers
Andrea

== GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.

So, the discussion so far points at WCS 2.0 spec trying to stay away from CRS related issues, and thus
in particular, this one specific to geographic bounding boxes.
From what I’ve read, it would seem that supporting both approaches (both inverted longitudes and out of
range longitudes) would be the way to go.

Cheers
Andrea

···

Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.

Hi Devon,
do you have plans to change the current WCS code after this discussion?

Cheers
Andrea

···

Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.

Hi Andrea

Thanks for the feedback. I’d like to fix the bug in question, however I’m not sure how to follow through on your comments. Should the requested range be passed along to the grid reader without any transformation or normalization? I think I need to look at the code a little further, since these types of requests seem to work fine in WCS 1.x. Should the code in 2.x just be changed to look more like 1.x maybe?

Cheers,
Devon

On Thu, Sep 27, 2018 at 1:32 AM Andrea Aime <andrea.aime@…1268…> wrote:

Hi Devon,
do you have plans to change the current WCS code after this discussion?

Cheers
Andrea

On Fri, Sep 21, 2018 at 9:17 AM Andrea Aime <andrea.aime@anonymised.com> wrote:

On Thu, Sep 20, 2018 at 9:32 AM Andrea Aime <andrea.aime@anonymised.com> wrote:

I’ve inquired on the WCS 2.0 SWG about it, will let you know.

So, the discussion so far points at WCS 2.0 spec trying to stay away from CRS related issues, and thus
in particular, this one specific to geographic bounding boxes.
From what I’ve read, it would seem that supporting both approaches (both inverted longitudes and out of
range longitudes) would be the way to go.

Cheers
Andrea

Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.

Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.

Hi Andrea

Thanks for the feedback. I’d like to fix the bug in question, however I’m not sure how to follow through on your comments. Should the requested range be passed along to the grid reader without any transformation or normalization?

Definitely not, the standard dateline crossing (max lon < min lon) must be recognized and handled

I think I need to look at the code a little further, since these types of requests seem to work fine in WCS 1.x. Should the code in 2.x just be changed to look more like 1.x maybe?

Err… do you have a pointer to that?

Cheers
Andrea

···

GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.