gpkg_spatial_ref_sys definition for srid=4326 does not match axis order in specification

Description

GeoPackage Community Plugin produces wrong SRS defintion for EPSG:4326. GeoPackage plugin uses GeoTools to produce that defintion. That's why the issue targets GeoTools.

The table gpkg_spatial_ref_sys contains the entries for srs_id=4326 (organization=EPSG and organization_coordsys_id04326):
gpkg_spatial_ref_sys.definition="GEOGCS["WGS 84", DATUM["World Geodetic System 1984", SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4326"]]"

Issue: This defines the axis order to be LONGITUDE / LATITUDE.
According to the GeoPackage standard, the axis order is as officially defined in the EPSG registry: LAT/LON.

gpkg_spatial_ref_sys.description="longitude/latitude coordinates in decimal degrees on the WGS 84 spheroid"

Issue: The description should read "latitude/longitude".

This default setting is defined in
https://github.com/geotools/geotools/blob/main/modules/plugin/geopkg/src/main/resources/org/geotools/geopkg/gpkg_spatial_ref_sys.sql

===

In addition to the place in the SQL file, https://github.com/geotools/geotools/blob/main/modules/plugin/geopkg/src/main/java/org/geotools/geopkg/GeoPackage.java lines 465-469 define another default definition for srs_id=4326:
"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");
Issue: This default definition should be consistent with the SQL definition.
issue: the description should define axis order as LAT/LON

Environment

Environment independent

Activity

Jody Garnett 
January 6, 2022 at 6:59 PM

Checking the geopackage specification they invoke “case 4” to force WKB to encode geometry in XYZM order.

The gpkg_spatial_ref_sys.sql should be consistent with the specification.

Jody Garnett 
November 4, 2021 at 3:51 AM

Thanks for reporting, some feedback on your ticket:
- the subject should be a bit more specific (no idea this was about geopackage until I read the description)
- we have components and so on for the different datastores

Aside: You indicate this is the “highest” priority for you, I recommend engaging commercial support if this is time crucial for you. My own volunteer time is … going into this month’s release.

Details

Assignee

Reporter

Triage

Components

Affects versions

Priority

Created November 2, 2021 at 8:31 AM
Updated January 6, 2022 at 6:59 PM