[Geoserver-devel] GeoPackage Extension Community Module - Issue with axis order

Hello everyone,

Is there a maintainer for the GeoPackage Extension Community Module?

https://docs.geoserver.org/stable/en/user/community/geopkg/output.html

It looks like there is an issue with AXIS ORDER for WKB when creating a GeoPacakge out of a WFS request using CRS EPSG:4326.

I’ve read that Community plugins are not part of the official GeoServer software stack. So I wonder what the best way might be to report the bug on this plugin?

Considering that I could provide a bugfix for consideration, what would be the best approach?

Best

Andreas

You’d probably be best raising a ticket against the supported GeoTools module (gepkg) which I assume provides the GeoServer Geopackage output. To be honest I’m not sure what the correct axis order for a GeoPackage is when requested from a WFS in 4326, and I’m not sure which OGC standard would apply (and if they agree).

Ian

···

Ian Turton

Hi,

GeoPackage geometry BLOB is defined in the GeoPackage standard. It is a WKB geometry (also OGC standard per OGC 06-103r4) with some additional flag bytes. Coordinate axis order in WKB BLOB and therefore also in GPKG BLOB is not affected by the coordinate reference system.

-Jukka Rahkonen-

···

Lähettäjä: Ian Turton <ijturton@…403…>
Lähetetty: torstai 28. lokakuuta 2021 17.50
Vastaanottaja: Andreas Matheus / Secure Dimensions <am@…6690…>
Kopio: Geoserver-devel geoserver-devel@lists.sourceforge.net
Aihe: Re: [Geoserver-devel] GeoPackage Extension Community Module - Issue with axis order

You’d probably be best raising a ticket against the supported GeoTools module (gepkg) which I assume provides the GeoServer Geopackage output. To be honest I’m not sure what the correct axis order for a GeoPackage is when requested from a WFS in 4326, and I’m not sure which OGC standard would apply (and if they agree).

Ian

On Thu, 28 Oct 2021 at 14:40, Andreas Matheus / Secure Dimensions <am@…6690…> wrote:

Hello everyone,

Is there a maintainer for the GeoPackage Extension Community Module?

https://docs.geoserver.org/stable/en/user/community/geopkg/output.html

It looks like there is an issue with AXIS ORDER for WKB when creating a GeoPacakge out of a WFS request using CRS EPSG:4326.

I’ve read that Community plugins are not part of the official GeoServer software stack. So I wonder what the best way might be to report the bug on this plugin?

Considering that I could provide a bugfix for consideration, what would be the best approach?

Best

Andreas


Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Ian Turton

Hello everyone,

Is there a maintainer for the GeoPackage Extension Community Module?

https://docs.geoserver.org/stable/en/user/community/geopkg/output.html

Not really, though I have been working on it (on contract), so I have passing familiarity with it.

It looks like there is an issue with AXIS ORDER for WKB when creating a GeoPacakge out of a WFS request using CRS EPSG:4326.

If you are using a WFS 1.1 or 2.0 request, then it would be normal that it produces geometries in lat/lon order, and that would
be reflected in the generated GeoPackage (it just dumps what it gets). I’d expect the WKT in the crs table to reflect the order though.
In GeoServer you get what you asked for, there are no format specific exceptions
(has been debated, but in the end, there is no funding to address it anyways.

I’ve read that Community plugins are not part of the official GeoServer software stack. So I wonder what the best way might be to report the bug on this plugin?

Use Jira anyways. But first let’s see if it’s really a bug.

Considering that I could provide a bugfix for consideration, what would be the best approach?

Make a pull request

Cheers
Andrea

···

GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 333 8128928

https://www.geosolutionsgroup.com/

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

This is the spec: https://docs.ogc.org/is/12-128r17/12-128r17.html

Two places are effected in the GeoPackage:

  • gpkg_contents table: min_x, min_y, max_x, max_y
  • user data table: row “geom” including WKB (as part of the BLOB)

For the *_x and *_y, GeoPackage Spec, Table 4 defines that *_x represents LON and *_y represents LAT, regardless of CRS. The current code produces LAT/LON values.

According to GeoPackage Requirement 19 the following is important to note:

“The axis order in WKB stored in a GeoPackage follows the de facto standard for axis order in WKB and is therefore always (x,y{,z}{,m}) where x is easting or longitude, y is northing or latitude, z is optional elevation, and m is optional measure. This ordering explicitly overrides the axis order as specified in the SRS metadata, applying Case 4 from OGC 08-038r7, Revision to Axis Order Policy and Recommendations[K11]. This was done to maintain consistency with previous implementations of WKB that predated the OGC policy.” And the OGC Policy Directive that resolves from K11 (https://portal.ogc.org/files/?artifact_id=76024) states for case 4: “The Encoding specification (document) explicitly overrides the Axis Order as specified in the CRS metadata: In this case, a specification (document) specifies a default CRS but then overrides the axis order of the CRS as specified in the CRS metadata. A typical example is to specify WGS 84 (EPSG 4326) in the specification but then state in the document that the axis order is the opposite of the CRS metadata. The payloads would then be encoded using the axis order as specified in the spec document and not in the CRS metadata. The OGC does not recommend implementing this use case.”

=> The current code produces LAT/LON values

Another aspect – not linked to the issue of axis order – is that the definition and description is wrong in

https://github.com/geotools/geotools/blob/main/modules/plugin/geopkg/src/main/resources/org/geotools/geopkg/gpkg_spatial_ref_sys.sql

The file states LON/LAT for EPSG:4326 but it should be LAT/LON.

The code in https://github.com/geotools/geotools/blob/main/modules/plugin/geopkg/src/main/java/org/geotools/geopkg/GeoPackage.java (lines 465 - 469) creates the CRS definition like this:



“GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",”



+ “6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],”



+ “PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,”



+ “AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]”,



“longitude/latitude coordinates in decimal degrees on the WGS 84 spheroid”);

There is no axis definition. But still there is a description that indicates wrong axis ordering. I’ve seen GeoPackages that use such a EPSG:4326 definition in their GeoPackage but they use another CRS for the actual geometry encodings…

Best

Andreas

From: “Rahkonen Jukka (MML)” jukka.rahkonen@anonymised.com
Date: Thursday, 28. October 2021 at 17:16
To: Ian Turton ijturton@anonymised.com, Andreas Matheus / Secure Dimensions am@anonymised.com
Cc: Geoserver Devel geoserver-devel@lists.sourceforge.net
Subject: VS: [Geoserver-devel] GeoPackage Extension Community Module - Issue with axis order

Hi,

GeoPackage geometry BLOB is defined in the GeoPackage standard. It is a WKB geometry (also OGC standard per OGC 06-103r4) with some additional flag bytes. Coordinate axis order in WKB BLOB and therefore also in GPKG BLOB is not affected by the coordinate reference system.

-Jukka Rahkonen-

Lähettäjä: Ian Turton ijturton@anonymised.com
Lähetetty: torstai 28. lokakuuta 2021 17.50
Vastaanottaja: Andreas Matheus / Secure Dimensions am@anonymised.com
Kopio: Geoserver-devel geoserver-devel@lists.sourceforge.net
Aihe: Re: [Geoserver-devel] GeoPackage Extension Community Module - Issue with axis order

You’d probably be best raising a ticket against the supported GeoTools module (gepkg) which I assume provides the GeoServer Geopackage output. To be honest I’m not sure what the correct axis order for a GeoPackage is when requested from a WFS in 4326, and I’m not sure which OGC standard would apply (and if they agree).

Ian

On Thu, 28 Oct 2021 at 14:40, Andreas Matheus / Secure Dimensions <am@anonymised.com> wrote:

Hello everyone,

Is there a maintainer for the GeoPackage Extension Community Module?

https://docs.geoserver.org/stable/en/user/community/geopkg/output.html

It looks like there is an issue with AXIS ORDER for WKB when creating a GeoPacakge out of a WFS request using CRS EPSG:4326.

I’ve read that Community plugins are not part of the official GeoServer software stack. So I wonder what the best way might be to report the bug on this plugin?

Considering that I could provide a bugfix for consideration, what would be the best approach?

Best

Andreas


Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Ian Turton

Dear all,

I’ve just created two tickets that link to the discussion below:

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

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

Best

Andreas

From: Andreas Matheus / Secure Dimensions am@anonymised.com
Date: Thursday, 28. October 2021 at 17:42
To: “Rahkonen Jukka (MML)” jukka.rahkonen@anonymised.com, Ian Turton ijturton@anonymised.com
Cc: Geoserver Devel geoserver-devel@lists.sourceforge.net
Subject: Re: [Geoserver-devel] GeoPackage Extension Community Module - Issue with axis order

Hi Jukka,

This is the spec: https://docs.ogc.org/is/12-128r17/12-128r17.html

Two places are effected in the GeoPackage:

· gpkg_contents table: min_x, min_y, max_x, max_y

· user data table: row “geom” including WKB (as part of the BLOB)

For the *_x and *_y, GeoPackage Spec, Table 4 defines that *_x represents LON and *_y represents LAT, regardless of CRS. The current code produces LAT/LON values.

According to GeoPackage Requirement 19 the following is important to note:

“The axis order in WKB stored in a GeoPackage follows the de facto standard for axis order in WKB and is therefore always (x,y{,z}{,m}) where x is easting or longitude, y is northing or latitude, z is optional elevation, and m is optional measure. This ordering explicitly overrides the axis order as specified in the SRS metadata, applying Case 4 from OGC 08-038r7, Revision to Axis Order Policy and Recommendations[K11]. This was done to maintain consistency with previous implementations of WKB that predated the OGC policy.” And the OGC Policy Directive that resolves from K11 (https://portal.ogc.org/files/?artifact_id=76024) states for case 4: “The Encoding specification (document) explicitly overrides the Axis Order as specified in the CRS metadata: In this case, a specification (document) specifies a default CRS but then overrides the axis order of the CRS as specified in the CRS metadata. A typical example is to specify WGS 84 (EPSG 4326) in the specification but then state in the document that the axis order is the opposite of the CRS metadata. The payloads would then be encoded using the axis order as specified in the spec document and not in the CRS metadata. The OGC does not recommend implementing this use case.”

=> The current code produces LAT/LON values

Another aspect – not linked to the issue of axis order – is that the definition and description is wrong in

https://github.com/geotools/geotools/blob/main/modules/plugin/geopkg/src/main/resources/org/geotools/geopkg/gpkg_spatial_ref_sys.sql

The file states LON/LAT for EPSG:4326 but it should be LAT/LON.

The code in https://github.com/geotools/geotools/blob/main/modules/plugin/geopkg/src/main/java/org/geotools/geopkg/GeoPackage.java (lines 465 - 469) creates the CRS definition like this:



“GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",”



+ “6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],”



+ “PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,”



+ “AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]”,



“longitude/latitude coordinates in decimal degrees on the WGS 84 spheroid”);

There is no axis definition. But still there is a description that indicates wrong axis ordering. I’ve seen GeoPackages that use such a EPSG:4326 definition in their GeoPackage but they use another CRS for the actual geometry encodings…

Best

Andreas

From: “Rahkonen Jukka (MML)” jukka.rahkonen@anonymised.com
Date: Thursday, 28. October 2021 at 17:16
To: Ian Turton ijturton@anonymised.com, Andreas Matheus / Secure Dimensions am@anonymised.com
Cc: Geoserver Devel geoserver-devel@anonymised.comrceforge.net
Subject: VS: [Geoserver-devel] GeoPackage Extension Community Module - Issue with axis order

Hi,

GeoPackage geometry BLOB is defined in the GeoPackage standard. It is a WKB geometry (also OGC standard per OGC 06-103r4) with some additional flag bytes. Coordinate axis order in WKB BLOB and therefore also in GPKG BLOB is not affected by the coordinate reference system.

-Jukka Rahkonen-

Lähettäjä: Ian Turton ijturton@anonymised.com
Lähetetty: torstai 28. lokakuuta 2021 17.50
Vastaanottaja: Andreas Matheus / Secure Dimensions am@anonymised.com
Kopio: Geoserver-devel geoserver-devel@lists.sourceforge.net
Aihe: Re: [Geoserver-devel] GeoPackage Extension Community Module - Issue with axis order

You’d probably be best raising a ticket against the supported GeoTools module (gepkg) which I assume provides the GeoServer Geopackage output. To be honest I’m not sure what the correct axis order for a GeoPackage is when requested from a WFS in 4326, and I’m not sure which OGC standard would apply (and if they agree).

Ian

On Thu, 28 Oct 2021 at 14:40, Andreas Matheus / Secure Dimensions <am@anonymised.com> wrote:

Hello everyone,

Is there a maintainer for the GeoPackage Extension Community Module?

https://docs.geoserver.org/stable/en/user/community/geopkg/output.html

It looks like there is an issue with AXIS ORDER for WKB when creating a GeoPacakge out of a WFS request using CRS EPSG:4326.

I’ve read that Community plugins are not part of the official GeoServer software stack. So I wonder what the best way might be to report the bug on this plugin?

Considering that I could provide a bugfix for consideration, what would be the best approach?

Best

Andreas


Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Ian Turton

_______________________________________________ Geoserver-devel mailing list Geoserver-devel@anonymised.comts.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-devel