diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 3adcd68257..9e1f2151dc 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -45,7 +45,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 "9a6b21de7b18f68719acb2260c3492fb") +set(PROJ_DB_SQL_EXPECTED_MD5 "bddbf24d9cc0d174e850ba1fda3ebb22") add_custom_command( OUTPUT ${PROJ_DB} diff --git a/data/sql/esri.sql b/data/sql/esri.sql index 3b5ae0d46e..f4f6183ca2 100644 --- a/data/sql/esri.sql +++ b/data/sql/esri.sql @@ -3557,6 +3557,46 @@ INSERT INTO "geodetic_crs" VALUES('ESRI','104999','Charon_2015',NULL,'geographic INSERT INTO "usage" VALUES('ESRI', '104999_USAGE','geodetic_crs','ESRI','104999','EPSG','1262','EPSG','1024'); INSERT INTO "deprecation" VALUES('geodetic_crs','ESRI','4305','ESRI','104026','ESRI'); INSERT INTO "deprecation" VALUES('geodetic_crs','ESRI','4812','ESRI','104025','ESRI'); +INSERT INTO alias_name VALUES('geodetic_datum','EPSG','6314','D_Deutsche_Hauptdreiecksnetz','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_datum','ESRI','106234','D_K0_1949','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_datum','EPSG','6696','D_Kasai_1955','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_datum','EPSG','6737','D_Korea_2000','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_datum','EPSG','6181','D_Luxembourg_1930','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_datum','EPSG','6140','D_North_American_1983_CSRS98','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_datum','ESRI','106245','D_Observ_Meteorological_1939','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_datum','EPSG','6683','D_Phillipine_Reference_System_1992','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_datum','ESRI','106235','D_Piton_des_Neiges','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_datum','ESRI','106235','D_Reunion','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_datum','EPSG','1064','D_SIRGAS-Chile','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_datum','EPSG','6629','D_Tahaa','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_datum','EPSG','6628','D_Tahiti','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','9308','ATRF2014_(3D)','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','9701','ETRF2000-PL_(3D)','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','4223','GCS_Carthage_Degree','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','4314','GCS_Deutsche_Hauptdreiecksnetz','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','4698','GCS_K0_1949','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','4696','GCS_Kasai_1955','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','4737','GCS_Korea_2000','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','4181','GCS_Luxembourg_1930','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','4617','GCS_North_American_1983_CSRS98','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','ESRI','37245','GCS_Observ_Meteorologico_1939','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','4626','GCS_Piton_des_Neiges','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','4626','GCS_Reunion','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','5360','GCS_SIRGAS-Chile','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','5359','GCS_SIRGAS-Chile_3D','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','4629','GCS_Tahaa','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','4628','GCS_Tahiti','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','4304','GCS_Voirol_1875_Degree','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','9379','IGb14_(3D)','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','9332','KSA-GRF17_(3D)','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','9546','LTF2004(G)_(3D)','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','9893','LUREF_(3D)','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','5342','POSGAR_3D','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','9695','REDGEOMIN_(3D)','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','20040','SIRGAS-Chile_2021_(3D)','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','9469','SRGI2013_(3D)','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','9754','WGS_1984_(G2139)_(3D)','ESRI_OLD'); +INSERT INTO alias_name VALUES('geodetic_crs','EPSG','9754','WGS_84_(G2139)_(3D)','ESRI_OLD'); INSERT INTO alias_name VALUES('projected_crs','EPSG','2000','Anguilla_1957_British_West_Indies_Grid','ESRI'); INSERT INTO alias_name VALUES('projected_crs','EPSG','2001','Antigua_1943_British_West_Indies_Grid','ESRI'); INSERT INTO alias_name VALUES('projected_crs','EPSG','2002','Dominica_1945_British_West_Indies_Grid','ESRI'); @@ -17168,6 +17208,60 @@ INSERT INTO "deprecation" VALUES('projected_crs','ESRI','103873','EPSG','22615', INSERT INTO "deprecation" VALUES('projected_crs','ESRI','103874','EPSG','22616','ESRI'); INSERT INTO "deprecation" VALUES('projected_crs','ESRI','103875','EPSG','22617','ESRI'); INSERT INTO "deprecation" VALUES('projected_crs','ESRI','103876','EPSG','22618','ESRI'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','3461','Dabola_UTM_Zone_28N','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','3462','Dabola_UTM_Zone_29N','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','3119','Douala_1948_AOF_West','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','3378','GDM_2000_State_Cassini_Negeri_Sembilan_&_Melaka','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','3382','GDM_2000_State_Cassini_Pulau_Pinang_&_Seberang_Perai','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','29902','Irish_National_Grid','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','3336','K0_1949_UTM_42S','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','5181','Korea_2000_Korea_Central_Belt','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','ESRI','102082','Korea_2000_Korea_Central_Belt_2010','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','5182','Korea_2000_Korea_Central_Belt_Jeju','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','5183','Korea_2000_Korea_East_Belt','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','ESRI','102083','Korea_2000_Korea_East_Belt_2010','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','5184','Korea_2000_Korea_East_Sea_Belt','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','ESRI','102084','Korea_2000_Korea_East_Sea_Belt_2010','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','ESRI','102080','Korea_2000_Korea_Unified_Coordinate_System','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','5180','Korea_2000_Korea_West_Belt','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','ESRI','102081','Korea_2000_Korea_West_Belt_2010','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','3346','Lietuvos_Koordinaciu_Sistema','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2169','Luxembourg_1930_Gauss','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','8677','MGI_1901_Balkans_5','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','8678','MGI_1901_Balkans_6','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','6316','MGI_1901_Balkans_7','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','8679','MGI_1901_Balkans_8','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','32045','NAD_1927_StatePlane_Vermont_FIPS_3400','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2952','NAD_1983_CRS98_MTM_10','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2945','NAD_1983_CRS98_MTM_3','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2946','NAD_1983_CRS98_MTM_4','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2947','NAD_1983_CRS98_MTM_5','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2948','NAD_1983_CRS98_MTM_6','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2949','NAD_1983_CRS98_MTM_7','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2950','NAD_1983_CRS98_MTM_8','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2951','NAD_1983_CRS98_MTM_9','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2944','NAD_1983_CSRS98_MTM_2_SCoPQ','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2953','NAD_1983_CSRS98_New_Brunswick_Stereographic','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2954','NAD_1983_CSRS98_Prince_Edward_Island','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2955','NAD_1983_CSRS98_UTM_Zone_11N','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2956','NAD_1983_CSRS98_UTM_Zone_12N','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2957','NAD_1983_CSRS98_UTM_Zone_13N','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','ESRI','102234','NAD_1983_CSRS98_UTM_Zone_14N','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','ESRI','102235','NAD_1983_CSRS98_UTM_Zone_15N','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','ESRI','102236','NAD_1983_CSRS98_UTM_Zone_16N','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2958','NAD_1983_CSRS98_UTM_Zone_17N','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2959','NAD_1983_CSRS98_UTM_Zone_18N','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2960','NAD_1983_CSRS98_UTM_Zone_19N','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2961','NAD_1983_CSRS98_UTM_Zone_20N','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2962','NAD_1983_CSRS98_UTM_Zone_21N','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','ESRI','102166','Observ_Meteorologico_1939_UTM_Zone_25N','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','3727','Piton_des_Neiges_TM_Reunion','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','3350','Pulkovo_1942_CS63_Zone_K0','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','3351','Pulkovo_1942_CS63_Zone_K1','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','5362','SIRGAS-Chile_UTM_Zone_18S','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','5361','SIRGAS-Chile_UTM_Zone_19S','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2977','Tahaa_UTM_5S','ESRI_OLD'); +INSERT INTO alias_name VALUES('projected_crs','EPSG','2976','Tahiti_UTM_6S','ESRI_OLD'); INSERT INTO alias_name VALUES('vertical_datum','EPSG','1027','EGM2008_Geoid','ESRI'); INSERT INTO alias_name VALUES('vertical_datum','EPSG','1028','Fao_1979','ESRI'); INSERT INTO alias_name VALUES('vertical_datum','EPSG','1039','New_Zealand_Vertical_Datum_2009','ESRI'); @@ -18612,6 +18706,18 @@ INSERT INTO "vertical_datum" VALUES('ESRI','from_geogdatum_EPSG_1365','North_Ame INSERT INTO "usage" VALUES('ESRI', 'from_geogdatum_EPSG_1365_USAGE','vertical_datum','ESRI','from_geogdatum_EPSG_1365','EPSG','1061','EPSG','1024'); INSERT INTO "vertical_crs" VALUES('ESRI','115931','NAD83(CSRS)v8',NULL,'ESRI','ELLPS_HEIGHT_METRE','ESRI','from_geogdatum_EPSG_1365',0); INSERT INTO "usage" VALUES('ESRI', '115931_USAGE','vertical_crs','ESRI','115931','EPSG','1061','EPSG','1024'); +INSERT INTO alias_name VALUES('vertical_datum','EPSG','1049','Incheon','ESRI_OLD'); +INSERT INTO alias_name VALUES('vertical_datum','EPSG','5122','Japanese_Standard_Levelling_Datum_1949','ESRI_OLD'); +INSERT INTO alias_name VALUES('vertical_datum','EPSG','5161','Lyttleton','ESRI_OLD'); +INSERT INTO alias_name VALUES('vertical_datum','EPSG','5177','National_Vertical_Network_1999','ESRI_OLD'); +INSERT INTO alias_name VALUES('vertical_crs','EPSG','5193','Incheon_Height','ESRI_OLD'); +INSERT INTO alias_name VALUES('vertical_crs','EPSG','5723','Japanese_Standard_Levelling_Datum_1949','ESRI_OLD'); +INSERT INTO alias_name VALUES('vertical_crs','ESRI','115742','Korea_2000','ESRI_OLD'); +INSERT INTO alias_name VALUES('vertical_crs','EPSG','5763','Lyttleton','ESRI_OLD'); +INSERT INTO alias_name VALUES('vertical_crs','EPSG','5774','NG_L','ESRI_OLD'); +INSERT INTO alias_name VALUES('vertical_crs','EPSG','5779','NVN99','ESRI_OLD'); +INSERT INTO alias_name VALUES('vertical_crs','EPSG','5779','NVN99 height','ESRI_OLD'); +INSERT INTO alias_name VALUES('vertical_crs','ESRI','115790','SIRGAS-Chile','ESRI_OLD'); INSERT INTO alias_name VALUES('compound_crs','EPSG','3901','KKJ_Finland_Uniform_Coordinate_System_and_N60_height','ESRI'); INSERT INTO alias_name VALUES('compound_crs','EPSG','3902','ETRS_1989_TM35FIN_and_N60_height','ESRI'); INSERT INTO alias_name VALUES('compound_crs','EPSG','3903','ETRS_1989_TM35FIN_and_N2000_height','ESRI'); @@ -19031,6 +19137,9 @@ INSERT INTO alias_name VALUES('compound_crs','EPSG','20003','MWC18_Grid_and_ODN_ INSERT INTO alias_name VALUES('compound_crs','EPSG','20037','NAD_1983_CSRS_v4_and_CGVD2013a(2002)_height','ESRI'); INSERT INTO alias_name VALUES('compound_crs','EPSG','20038','NAD_1983_CSRS_v3_and_CGVD2013a(1997)_height','ESRI'); INSERT INTO alias_name VALUES('compound_crs','EPSG','20043','SRGI2013_and_INAGeoid2020_v2_height','ESRI'); +INSERT INTO alias_name VALUES('compound_crs','EPSG','9463','GDA2020_+_AHD_height','ESRI_OLD'); +INSERT INTO alias_name VALUES('compound_crs','EPSG','9462','GDA2020_+_AVWS_height','ESRI_OLD'); +INSERT INTO alias_name VALUES('compound_crs','EPSG','9464','GDA94_+_AHD_height','ESRI_OLD'); INSERT INTO "alias_name" VALUES('helmert_transformation','EPSG',1024,'MGI_To_ETRS_1989_4','ESRI'); INSERT INTO "alias_name" VALUES('helmert_transformation','EPSG',1055,'Ain_el_Abd_To_WGS_1984_3','ESRI'); INSERT INTO "alias_name" VALUES('helmert_transformation','EPSG',1056,'Ain_El_Abd_To_WGS_1984_4','ESRI'); diff --git a/scripts/build_db_from_esri.py b/scripts/build_db_from_esri.py index 4e85e69622..8c3da1f50d 100755 --- a/scripts/build_db_from_esri.py +++ b/scripts/build_db_from_esri.py @@ -41,20 +41,45 @@ from typing import Optional, List, Dict parser = argparse.ArgumentParser() -parser.add_argument('esri_csv_dir', help='Path to ESRI CSV dir, typically the path ' - 'to the "csv" directory of a "git clone ' - 'https://github.com/Esri/projection-engine-db-doc', +parser.add_argument('esri_dir', help='Path to ESRI projection-engine-db-doc dir,' + 'typically the path to a "git clone ' + 'https://github.com/Esri/projection-engine-db-doc"', type=Path) parser.add_argument('proj_db', help='Path to current proj.db file', type=Path) parser.add_argument('version', help='ArcMap version string, e.g. "ArcMap 10.8.1"') parser.add_argument('date', help='ArcMap version date as a yyyy-MM-dd string, e.g. "2020-05-24"') args = parser.parse_args() -path_to_csv = args.esri_csv_dir +path_to_csv = args.esri_dir / "csv" +path_to_objedit = args.esri_dir / "objedit" proj_db = args.proj_db version = args.version date = args.date + +######################## + +def import_syn(filename): + + lst = [] + with open(filename, "rt", encoding="UTF-8") as f: + lines = f.readlines() + for idx in range(len(lines)): + line = lines[idx][0:-1] + if line.startswith('"') and line.endswith('", \\'): + old_name = line[1:-4] + idx += 1 + line = lines[idx][0:-1] + assert line.startswith(' "') + assert line.endswith('", \\') + new_name = line[4:-4] + idx += 1 + line = lines[idx][0:-1] + assert line in (' TRUE, \\', ' FALSE, \\') + if line == ' TRUE, \\': + lst.append((new_name, old_name)) + return lst + conn = sqlite3.connect(proj_db) cursor = conn.cursor() @@ -394,7 +419,6 @@ def import_prime_meridian(): code, esri_name, value, deprecated) all_sql.append(sql) - ######################## map_datum_esri_name_to_auth_code = {} @@ -422,6 +446,7 @@ def get_old_esri_name(s): return s def import_datum(): + with open(path_to_csv / 'pe_list_datum.csv', 'rt') as csvfile: reader = csv.reader(csvfile) header = next(reader) @@ -753,6 +778,24 @@ def import_geogcs(): code, map_code_to_authority[replacement_code], replacement_code) all_sql.append(sql) + aliases = import_syn(path_to_objedit / "datum_syn.txt") + for (new_name, old_name) in aliases: + + (auth, code) = map_datum_esri_name_to_auth_code[new_name] + + sql = """INSERT INTO alias_name VALUES('geodetic_datum','%s','%s','%s','ESRI_OLD');""" % ( + auth, code, escape_literal(old_name)) + all_sql.append(sql) + + aliases = import_syn(path_to_objedit / "geogcs_syn.txt") + for (new_name, old_name) in aliases: + + (auth, code) = map_geogcs_esri_name_to_auth_code[new_name] + + sql = """INSERT INTO alias_name VALUES('geodetic_crs','%s','%s','%s','ESRI_OLD');""" % ( + auth, code, escape_literal(old_name)) + all_sql.append(sql) + ######################## @@ -1560,6 +1603,15 @@ def import_projcs(): code, latestWkid) all_sql.append(sql) + aliases = import_syn(path_to_objedit / "projcs_syn.txt") + for (new_name, old_name) in aliases: + + (auth, code) = map_projcs_esri_name_to_auth_code[new_name] + + sql = """INSERT INTO alias_name VALUES('projected_crs','%s','%s','%s','ESRI_OLD');""" % ( + auth, code, escape_literal(old_name)) + all_sql.append(sql) + ######################## @@ -1830,7 +1882,7 @@ def import_vertcs(): sql = """INSERT INTO "usage" VALUES('ESRI', '%s_USAGE','vertical_datum','ESRI','%s','%s','%s','%s','%s');""" % (datum_code, datum_code, extent_auth_name, extent_code, 'EPSG', '1024') all_sql.append(sql) - #map_vertcs_esri_name_to_auth_code[esri_name] = ['ESRI', code] + map_vertcs_esri_name_to_auth_code[esri_name] = ['ESRI', code] parsed_wkt2 = parse_wkt_array(wkt2) @@ -1883,6 +1935,24 @@ def import_vertcs(): code, map_code_to_authority[replacement_code], replacement_code) all_sql.append(sql) + aliases = import_syn(path_to_objedit / "vdatum_syn.txt") + for (new_name, old_name) in aliases: + + (auth, code) = map_vdatum_esri_name_to_auth_code[new_name] + + sql = """INSERT INTO alias_name VALUES('vertical_datum','%s','%s','%s','ESRI_OLD');""" % ( + auth, code, escape_literal(old_name)) + all_sql.append(sql) + + aliases = import_syn(path_to_objedit / "vertcs_syn.txt") + for (new_name, old_name) in aliases: + + (auth, code) = map_vertcs_esri_name_to_auth_code[new_name] + + sql = """INSERT INTO alias_name VALUES('vertical_crs','%s','%s','%s','ESRI_OLD');""" % ( + auth, code, escape_literal(old_name)) + all_sql.append(sql) + ######################## @@ -1972,6 +2042,14 @@ def import_hvcoordsys(): else: assert False, row # no ESRI specific entries at that time ! + aliases = import_syn(path_to_objedit / "hvcoordsys_syn.txt") + for (new_name, old_name) in aliases: + + (auth, code) = map_compoundcrs_esri_name_to_auth_code[new_name] + + sql = """INSERT INTO alias_name VALUES('compound_crs','%s','%s','%s','ESRI_OLD');""" % ( + auth, code, escape_literal(old_name)) + all_sql.append(sql) ######################## diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp index 31a3551079..a9e182bab8 100644 --- a/test/unit/test_crs.cpp +++ b/test/unit/test_crs.cpp @@ -2523,6 +2523,37 @@ TEST(crs, projectedCRS_from_EPSG_as_WKT1_ESRI_s_jtsk03_krovak_east_north) { // --------------------------------------------------------------------------- +TEST(crs, projectedCRS_from_EPSG_with_deprecated_ESRI_name_as_WKT1_ESRI) { + auto dbContext = DatabaseContext::create(); + auto crs = + AuthorityFactory::create(dbContext, "EPSG")->createProjectedCRS("5186"); + + // Check we use the non-deprecated ESRI names, so: + // "KGD2002_Central_Belt_2010" and not "Korea_2000_Korea_Central_Belt_2010" + // "GCS_KGD2002" and not "GCS_Korea_2000" + // "D_Korea_Geodetic_Datum_2002" and not "D_Korea_2000" + auto esri_wkt = + "PROJCS[\"KGD2002_Central_Belt_2010\",GEOGCS[\"GCS_KGD2002\"," + "DATUM[\"D_Korea_Geodetic_Datum_2002\"," + "SPHEROID[\"GRS_1980\",6378137.0,298.257222101]]," + "PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]," + "PROJECTION[\"Transverse_Mercator\"]," + "PARAMETER[\"False_Easting\",200000.0]," + "PARAMETER[\"False_Northing\",600000.0]," + "PARAMETER[\"Central_Meridian\",127.0]," + "PARAMETER[\"Scale_Factor\",1.0]," + "PARAMETER[\"Latitude_Of_Origin\",38.0]," + "UNIT[\"Meter\",1.0]]"; + + EXPECT_EQ( + crs->exportToWKT( + WKTFormatter::create(WKTFormatter::Convention::WKT1_ESRI, dbContext) + .get()), + esri_wkt); +} + +// --------------------------------------------------------------------------- + TEST(crs, projectedCRS_as_PROJ_string) { auto crs = createProjected(); @@ -3468,6 +3499,30 @@ TEST(crs, projectedCRS_identify_db) { "IAU_2015"); EXPECT_EQ(res.front().second, 90); } + { + // Identify a WKT ESRI using deprecated ESRI names + // Cf https://github.com/OSGeo/PROJ/issues/4281 + auto obj = WKTParser().attachDatabaseContext(dbContext).createFromWKT( + "PROJCS[\"Korea_2000_Korea_Central_Belt_2010\"," + "GEOGCS[\"GCS_Korea_2000\",DATUM[\"D_Korea_2000\"," + "SPHEROID[\"GRS_1980\",6378137.0,298.257222101]]," + "PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]," + "PROJECTION[\"Transverse_Mercator\"]," + "PARAMETER[\"False_Easting\",200000.0]," + "PARAMETER[\"False_Northing\",600000.0]," + "PARAMETER[\"Central_Meridian\",127.0]," + "PARAMETER[\"Scale_Factor\",1.0]," + "PARAMETER[\"Latitude_Of_Origin\",38.0]," + "UNIT[\"Meter\",1.0]]"); + auto crs = nn_dynamic_pointer_cast(obj); + ASSERT_TRUE(crs != nullptr); + auto allFactory = AuthorityFactory::create(dbContext, std::string()); + auto res = crs->identify(allFactory); + ASSERT_GE(res.size(), 1U); + EXPECT_EQ(res.front().first->identifiers()[0]->code(), "102082"); + EXPECT_EQ(*(res.front().first->identifiers()[0]->codeSpace()), "ESRI"); + EXPECT_EQ(res.front().second, 90); + } } // ---------------------------------------------------------------------------