Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPKG: map Null CRS to a new srs_id=99999, and add a SRID layer creation option #9595

Merged
merged 2 commits into from
Apr 14, 2024

Conversation

rouault
Copy link
Member

@rouault rouault commented Apr 2, 2024

New layer creation option:

-  .. lco:: SRID
      :choices: <integer>
      :since: 3.9

      Forced ``srs_id`` of the entry in the ``gpkg_spatial_ref_sys`` table to point to.
      This may be -1 ("Undefined Cartesian SRS"), 0 ("Undefined geographic SRS"),
      99999 ("Undefined SRS"), a valid EPSG CRS code or an existing entry of the
      ``gpkg_spatial_ref_sys`` table. If pointing to a non-existing entry, only a warning
      will be emitted.
Coordinate Reference Systems
----------------------------

Starting with GDAL 3.9, a layer without any explicit CRS is mapped from/to a
custom entry of srs_id=99999 with the following properties:

- ``srs_name``: ``Undefined SRS``
- ``organization``: ``GDAL``
- ``organization_coordsys_id``: 99999
- ``definition``: ``LOCAL_CS["Undefined SRS",LOCAL_DATUM["unknown",32767],UNIT["unknown",0],AXIS["Easting",EAST],AXIS["Northing",NORTH]]``
- ``definition_12_063`` (when the CRS WKT extension is used): ``ENGCRS["Undefined SRS",EDATUM["unknown"],CS[Cartesian,2],AXIS["easting",east,ORDER[1],LENGTHUNIT["unknown",0]],AXIS["northing",north,ORDER[2],LENGTHUNIT["unknown",0]]]``
- ``description``: ``Custom undefined coordinate reference system``

Note that the use of a LOCAL_CS / EngineeringCRS is mostly to provide a valid
CRS definition to comply with the requirements of the GeoPackage specification
and to be compatible of other applications (or GDAL 3.8 or earlier), but the
semantics of that entry is intented to be "undefined SRS of any kind".

…tree statement that exactly matches the OGC GeoPackage conformance test suite
@jratike80
Copy link
Collaborator

Is it good to use different srs_id=99999 and organization_coordsys_id=0? There may be a slight possibility for a mess because geopackage developers can think that those two are always equal, because usually for the EPSG codes they are. But if someone cares about the organization then hopefully they check correctly the combination organization + organization_coordsys_id and notice that NONE:0 is not the same than GDAL:0.
(Well, I think I wouldn't care about that difference myself, and at least not between NONE:-1 and GDAL:0)

Maybe the definition could somehow distinct the new undefined from the two existing undefined variants. Something like "Custom undefined coordinate reference system". Or "Undefined coordinate reference system using undefined units". This suggestion does not feel most clear.

0 (NONE 0) = undefined Cartesian coordinate reference system
-1 (NONE -1) = undefined geographic coordinate reference system
99999 (GDAL 0) = undefined coordinate reference system

Was there someone who wished to have undefined undefined Cartesian and undefined undefined non-Cartesian?

@rouault
Copy link
Member Author

rouault commented Apr 2, 2024

Is it good to use different srs_id=99999 and organization_coordsys_id=0?

ok, I've change organization_coordsys_id to 99999 as well

Something like "Custom undefined coordinate reference system"

I've changed to that

…on option

New layer creation option:
```
-  .. lco:: SRID
      :choices: <integer>
      :since: 3.9

      Forced ``srs_id`` of the entry in the ``gpkg_spatial_ref_sys`` table to point to.
      This may be -1 ("Undefined Cartesian SRS"), 0 ("Undefined geographic SRS"),
      99999 ("Undefined SRS"), a valid EPSG CRS code or an existing entry of the
      ``gpkg_spatial_ref_sys`` table. If pointing to a non-existing entry, only a warning
      will be emitted.
```

```
Coordinate Reference Systems
----------------------------

Starting with GDAL 3.9, a layer without any explicit CRS is mapped from/to a
custom entry of srs_id=99999 with the following properties:

- ``srs_name``: ``Undefined SRS``
- ``organization``: ``GDAL``
- ``organization_coordsys_id``: 99999
- ``definition``: ``LOCAL_CS["Undefined SRS",LOCAL_DATUM["unknown",32767],UNIT["unknown",0],AXIS["Easting",EAST],AXIS["Northing",NORTH]]``
- ``definition_12_063`` (when the CRS WKT extension is used): ``ENGCRS["Undefined SRS",EDATUM["unknown"],CS[Cartesian,2],AXIS["easting",east,ORDER[1],LENGTHUNIT["unknown",0]],AXIS["northing",north,ORDER[2],LENGTHUNIT["unknown",0]]]``
- ``description``: ``Custom undefined coordinate reference system``

Note that the use of a LOCAL_CS / EngineeringCRS is mostly to provide a valid
CRS definition to comply with the requirements of the GeoPackage specification
and to be compatible of other applications (or GDAL 3.8 or earlier), but the
semantics of that entry is intented to be "undefined SRS `of any nature".
```
@rouault rouault merged commit 5d444f6 into OSGeo:master Apr 14, 2024
32 checks passed
@rouault
Copy link
Member Author

rouault commented Apr 18, 2024

Fixes #9580

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants