Skip to content

Commit

Permalink
Database: add an optional step_direction column to the concatenated_o…
Browse files Browse the repository at this point in the history
…peration_step table

and consequently bump database version structure to 1.5

Building a concatenated operation from its steps is a incredibly complex
logic, which requires:
- figuring out in which direction the step must be actually run
- set source/target CRS on conversions, that natively lack it, by
  propagating. This is done by propagating CRS from the neighbouring
  steps... when this is possible. If you chain directly too many conversions,
  we'll lack the information at some point. Hopefully for records we
  have, this is mostly just a theoretical concern (I believe, not
  totally sure...)
  All that is to satisfy consistency checks, that check that
  target_crs[op[n]] == source_crs[op[n+1]]. Although in some cases we do
  need to access the CRS. Typically for a map projection to know the
  ellipsoid shape. So the alternative would be to attach the ellipsoid
  shape as a parameter of a map projection (the good old +ellps
  parameter of PROJ.4 strings) rather than relying on the one of the base
  geographic CRS.
- sometimes insert an implicit Geographic<-->Geocentric conversion step
- other things I might not even suspect.

This change tries to slightly improve this by addressing the first issue
mentioned - figuring out the direction - by adding a step_direction column to the
concatenated_operation_step table. Obviously as currently the EPSG
dataset doesn't include such information (CC @RogerLott with which I've
recently discussed that issue), we must still allow a NULL value to mean
unknown. For the few records we maintain under our PROJ authority, we can
define it though. At least, this improves a bit the readability of our records.

While writing all this, and recalling code I had to write in past years
in the pipeline inference logic that need to synthetize intermediate CRS,
I'm strongly thinking to what you mentionned @busstoptaktik about the
limitations of the current model... Requiring that operation steps have
a CRS is a major practical annoyance.
  • Loading branch information
rouault committed Dec 20, 2024
1 parent 3421b04 commit 6c9ca65
Show file tree
Hide file tree
Showing 20 changed files with 798 additions and 1,878 deletions.
2 changes: 1 addition & 1 deletion data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set(ALL_SQL_IN "${CMAKE_CURRENT_BINARY_DIR}/all.sql.in")
set(PROJ_DB "${CMAKE_CURRENT_BINARY_DIR}/proj.db")
include(sql_filelist.cmake)

set(PROJ_DB_SQL_EXPECTED_MD5 "5cae0af56a2189692c8e1cf83fe7929e")
set(PROJ_DB_SQL_EXPECTED_MD5 "dfcc6e3e854b4479ed738ccec2ccee0e")

add_custom_command(
OUTPUT ${PROJ_DB}
Expand Down
1,008 changes: 504 additions & 504 deletions data/sql/concatenated_operation_step.sql

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions data/sql/ignf.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4345,41 +4345,41 @@ INSERT INTO "usage" VALUES('PROJ', 'IGNF_RGF93GDD_TO_EPSG_4326_USAGE','helmert_t

INSERT INTO "concatenated_operation" VALUES('IGNF','TSG62_NTFPGRAD_TO_ED50G','Nouvelle Triangulation Francaise Paris grades to ED50G',NULL,'IGNF','NTFPGRAD','IGNF','ED50G',NULL,'1.0.0',0);
INSERT INTO "usage" VALUES('IGNF', 'TSG62_NTFPGRAD_TO_ED50G_USAGE','concatenated_operation','IGNF','TSG62_NTFPGRAD_TO_ED50G','IGNF','91','IGNF','6');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFPGRAD_TO_ED50G',1,'IGNF','TSG1240');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFPGRAD_TO_ED50G',2,'IGNF','TSG62_NTFG_TO_ED50G');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFPGRAD_TO_ED50G',1,'IGNF','TSG1240',NULL);
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFPGRAD_TO_ED50G',2,'IGNF','TSG62_NTFG_TO_ED50G',NULL);
INSERT INTO "concatenated_operation" VALUES('IGNF','TSG62_NTFP_TO_ED50G','Nouvelle Triangulation Francaise Paris grades to ED50G',NULL,'IGNF','NTFP','IGNF','ED50G',NULL,'1.0.0',0);
INSERT INTO "usage" VALUES('IGNF', 'TSG62_NTFP_TO_ED50G_USAGE','concatenated_operation','IGNF','TSG62_NTFP_TO_ED50G','IGNF','91','IGNF','6');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFP_TO_ED50G',1,'IGNF','TSG1240_IGNF_NTFP_TO_IGNF_NTFG');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFP_TO_ED50G',2,'IGNF','TSG62_NTFG_TO_ED50G');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFP_TO_ED50G',1,'IGNF','TSG1240_IGNF_NTFP_TO_IGNF_NTFG',NULL);
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFP_TO_ED50G',2,'IGNF','TSG62_NTFG_TO_ED50G',NULL);
INSERT INTO "concatenated_operation" VALUES('IGNF','TSG62_NTFPGRAD_TO_ED50GEO','Nouvelle Triangulation Francaise Paris grades to ED50GEO',NULL,'IGNF','NTFPGRAD','IGNF','ED50GEO',NULL,'1.0.0',0);
INSERT INTO "usage" VALUES('IGNF', 'TSG62_NTFPGRAD_TO_ED50GEO_USAGE','concatenated_operation','IGNF','TSG62_NTFPGRAD_TO_ED50GEO','IGNF','91','IGNF','6');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFPGRAD_TO_ED50GEO',1,'IGNF','TSG1240');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFPGRAD_TO_ED50GEO',2,'IGNF','TSG62_NTFG_TO_ED50GEO');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFPGRAD_TO_ED50GEO',1,'IGNF','TSG1240',NULL);
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFPGRAD_TO_ED50GEO',2,'IGNF','TSG62_NTFG_TO_ED50GEO',NULL);
INSERT INTO "concatenated_operation" VALUES('IGNF','TSG62_NTFP_TO_ED50GEO','Nouvelle Triangulation Francaise Paris grades to ED50GEO',NULL,'IGNF','NTFP','IGNF','ED50GEO',NULL,'1.0.0',0);
INSERT INTO "usage" VALUES('IGNF', 'TSG62_NTFP_TO_ED50GEO_USAGE','concatenated_operation','IGNF','TSG62_NTFP_TO_ED50GEO','IGNF','91','IGNF','6');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFP_TO_ED50GEO',1,'IGNF','TSG1240_IGNF_NTFP_TO_IGNF_NTFG');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFP_TO_ED50GEO',2,'IGNF','TSG62_NTFG_TO_ED50GEO');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFP_TO_ED50GEO',1,'IGNF','TSG1240_IGNF_NTFP_TO_IGNF_NTFG',NULL);
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG62_NTFP_TO_ED50GEO',2,'IGNF','TSG62_NTFG_TO_ED50GEO',NULL);
INSERT INTO "concatenated_operation" VALUES('IGNF','TSG399_NTFPGRAD_TO_WGS84GDD','Nouvelle Triangulation Francaise Paris grades to WGS84GDD',NULL,'IGNF','NTFPGRAD','IGNF','WGS84GDD',NULL,'1.0.0',0);
INSERT INTO "usage" VALUES('IGNF', 'TSG399_NTFPGRAD_TO_WGS84GDD_USAGE','concatenated_operation','IGNF','TSG399_NTFPGRAD_TO_WGS84GDD','IGNF','91','IGNF','6');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFPGRAD_TO_WGS84GDD',1,'IGNF','TSG1240');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFPGRAD_TO_WGS84GDD',2,'IGNF','TSG399_NTFG_TO_WGS84GDD');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFPGRAD_TO_WGS84GDD',1,'IGNF','TSG1240',NULL);
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFPGRAD_TO_WGS84GDD',2,'IGNF','TSG399_NTFG_TO_WGS84GDD',NULL);
INSERT INTO "concatenated_operation" VALUES('IGNF','TSG399_NTFP_TO_WGS84GDD','Nouvelle Triangulation Francaise Paris grades to WGS84GDD',NULL,'IGNF','NTFP','IGNF','WGS84GDD',NULL,'1.0.0',0);
INSERT INTO "usage" VALUES('IGNF', 'TSG399_NTFP_TO_WGS84GDD_USAGE','concatenated_operation','IGNF','TSG399_NTFP_TO_WGS84GDD','IGNF','91','IGNF','6');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFP_TO_WGS84GDD',1,'IGNF','TSG1240_IGNF_NTFP_TO_IGNF_NTFG');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFP_TO_WGS84GDD',2,'IGNF','TSG399_NTFG_TO_WGS84GDD');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFP_TO_WGS84GDD',1,'IGNF','TSG1240_IGNF_NTFP_TO_IGNF_NTFG',NULL);
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFP_TO_WGS84GDD',2,'IGNF','TSG399_NTFG_TO_WGS84GDD',NULL);
INSERT INTO "concatenated_operation" VALUES('IGNF','TSG399_NTFPGRAD_TO_WGS84G','Nouvelle Triangulation Francaise Paris grades to WGS84G',NULL,'IGNF','NTFPGRAD','IGNF','WGS84G',NULL,'1.0.0',0);
INSERT INTO "usage" VALUES('IGNF', 'TSG399_NTFPGRAD_TO_WGS84G_USAGE','concatenated_operation','IGNF','TSG399_NTFPGRAD_TO_WGS84G','IGNF','91','IGNF','6');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFPGRAD_TO_WGS84G',1,'IGNF','TSG1240');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFPGRAD_TO_WGS84G',2,'IGNF','TSG399_NTFG_TO_WGS84G');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFPGRAD_TO_WGS84G',1,'IGNF','TSG1240',NULL);
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFPGRAD_TO_WGS84G',2,'IGNF','TSG399_NTFG_TO_WGS84G',NULL);
INSERT INTO "concatenated_operation" VALUES('IGNF','TSG399_NTFP_TO_WGS84G','Nouvelle Triangulation Francaise Paris grades to WGS84G',NULL,'IGNF','NTFP','IGNF','WGS84G',NULL,'1.0.0',0);
INSERT INTO "usage" VALUES('IGNF', 'TSG399_NTFP_TO_WGS84G_USAGE','concatenated_operation','IGNF','TSG399_NTFP_TO_WGS84G','IGNF','91','IGNF','6');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFP_TO_WGS84G',1,'IGNF','TSG1240_IGNF_NTFP_TO_IGNF_NTFG');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFP_TO_WGS84G',2,'IGNF','TSG399_NTFG_TO_WGS84G');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFP_TO_WGS84G',1,'IGNF','TSG1240_IGNF_NTFP_TO_IGNF_NTFG',NULL);
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFP_TO_WGS84G',2,'IGNF','TSG399_NTFG_TO_WGS84G',NULL);
INSERT INTO "concatenated_operation" VALUES('IGNF','TSG399_NTFPGRAD_TO_4326','Nouvelle Triangulation Francaise Paris grades to 4326',NULL,'IGNF','NTFPGRAD','EPSG','4326',NULL,'1.0.0',0);
INSERT INTO "usage" VALUES('IGNF', 'TSG399_NTFPGRAD_TO_4326_USAGE','concatenated_operation','IGNF','TSG399_NTFPGRAD_TO_4326','IGNF','91','IGNF','6');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFPGRAD_TO_4326',1,'IGNF','TSG1240');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFPGRAD_TO_4326',2,'IGNF','TSG399_NTFG_TO_4326');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFPGRAD_TO_4326',1,'IGNF','TSG1240',NULL);
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFPGRAD_TO_4326',2,'IGNF','TSG399_NTFG_TO_4326',NULL);
INSERT INTO "concatenated_operation" VALUES('IGNF','TSG399_NTFP_TO_4326','Nouvelle Triangulation Francaise Paris grades to 4326',NULL,'IGNF','NTFP','EPSG','4326',NULL,'1.0.0',0);
INSERT INTO "usage" VALUES('IGNF', 'TSG399_NTFP_TO_4326_USAGE','concatenated_operation','IGNF','TSG399_NTFP_TO_4326','IGNF','91','IGNF','6');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFP_TO_4326',1,'IGNF','TSG1240_IGNF_NTFP_TO_IGNF_NTFG');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFP_TO_4326',2,'IGNF','TSG399_NTFG_TO_4326');
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFP_TO_4326',1,'IGNF','TSG1240_IGNF_NTFP_TO_IGNF_NTFG',NULL);
INSERT INTO "concatenated_operation_step" VALUES('IGNF','TSG399_NTFP_TO_4326',2,'IGNF','TSG399_NTFG_TO_4326',NULL);
2 changes: 1 addition & 1 deletion data/sql/metadata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-- DATABASE_LAYOUT_VERSION_MINOR constants in src/iso19111/factory.cpp must be
-- updated as well.
INSERT INTO "metadata" VALUES('DATABASE.LAYOUT.VERSION.MAJOR', 1);
INSERT INTO "metadata" VALUES('DATABASE.LAYOUT.VERSION.MINOR', 4);
INSERT INTO "metadata" VALUES('DATABASE.LAYOUT.VERSION.MINOR', 5);

INSERT INTO "metadata" VALUES('EPSG.VERSION', 'v11.025');
INSERT INTO "metadata" VALUES('EPSG.DATE', '2024-12-14');
Expand Down
Loading

0 comments on commit 6c9ca65

Please sign in to comment.