Skip to content

Commit

Permalink
Database (ESRI): do not add an entry in deprecated table for a deprec…
Browse files Browse the repository at this point in the history
…ated CRS that would be obsoleted by a deprecated EPSG CRS
  • Loading branch information
rouault committed Jan 29, 2024
1 parent 48ca579 commit 9866bef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
3 changes: 0 additions & 3 deletions data/sql/esri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1995,7 +1995,6 @@ INSERT INTO "geodetic_datum" VALUES('ESRI','106228','D_Viti_Levu_1916','Viti Lev
INSERT INTO "usage" VALUES('ESRI', '106228_USAGE','geodetic_datum','ESRI','106228','EPSG','3195','EPSG','1024');
INSERT INTO "geodetic_crs" VALUES('ESRI','37228','GCS_Viti_Levu_1916',NULL,'geographic 2D','EPSG','6422','ESRI','106228',NULL,1);
INSERT INTO "usage" VALUES('ESRI', '37228_USAGE','geodetic_crs','ESRI','37228','EPSG','3195','EPSG','1024');
INSERT INTO "deprecation" VALUES('geodetic_crs','ESRI','37228','EPSG','4731','ESRI');
INSERT INTO "geodetic_datum" VALUES('ESRI','106229','D_Wake_Eniwetok_1960','Wake-Eniwetok 1960 (Marshall Islands 1960)','EPSG','7053','EPSG','8901',NULL,NULL,NULL,NULL,NULL,1);
INSERT INTO "usage" VALUES('ESRI', '106229_USAGE','geodetic_datum','ESRI','106229','EPSG','3191','EPSG','1024');
INSERT INTO "geodetic_crs" VALUES('ESRI','37229','GCS_Wake_Eniwetok_1960',NULL,'geographic 2D','EPSG','6422','ESRI','106229',NULL,1);
Expand Down Expand Up @@ -2416,7 +2415,6 @@ INSERT INTO "geodetic_datum" VALUES('ESRI','106283','D_WGS_1984_Major_Auxiliary_
INSERT INTO "usage" VALUES('ESRI', '106283_USAGE','geodetic_datum','ESRI','106283','EPSG','1262','EPSG','1024');
INSERT INTO "geodetic_crs" VALUES('ESRI','104199','GCS_WGS_1984_Major_Auxiliary_Sphere',NULL,'geographic 2D','EPSG','6422','ESRI','106283',NULL,1);
INSERT INTO "usage" VALUES('ESRI', '104199_USAGE','geodetic_crs','ESRI','104199','EPSG','1262','EPSG','1024');
INSERT INTO "deprecation" VALUES('geodetic_crs','ESRI','104199','EPSG','4055','ESRI');
INSERT INTO "geodetic_datum" VALUES('ESRI','106223','D_NAD_1983_CORS96','NAD 1983 (CORS96)','EPSG','7019','EPSG','8901',NULL,NULL,NULL,NULL,NULL,1);
INSERT INTO "usage" VALUES('ESRI', '106223_USAGE','geodetic_datum','ESRI','106223','EPSG','1511','EPSG','1024');
INSERT INTO "geodetic_crs" VALUES('ESRI','104223','GCS_NAD_1983_CORS96',NULL,'geographic 2D','EPSG','6422','ESRI','106223',NULL,1);
Expand Down Expand Up @@ -16311,7 +16309,6 @@ INSERT INTO "deprecation" VALUES('projected_crs','ESRI','102100','EPSG','3857','
INSERT INTO "deprecation" VALUES('projected_crs','ESRI','102110','EPSG','2154','ESRI');
INSERT INTO "deprecation" VALUES('projected_crs','ESRI','102111','EPSG','5519','ESRI');
INSERT INTO "deprecation" VALUES('projected_crs','ESRI','102112','EPSG','3764','ESRI');
INSERT INTO "deprecation" VALUES('projected_crs','ESRI','102113','EPSG','3785','ESRI');
INSERT INTO "deprecation" VALUES('projected_crs','ESRI','102119','EPSG','3080','ESRI');
INSERT INTO "deprecation" VALUES('projected_crs','ESRI','102123','EPSG','3078','ESRI');
INSERT INTO "deprecation" VALUES('projected_crs','ESRI','102124','EPSG','26701','ESRI');
Expand Down
32 changes: 18 additions & 14 deletions scripts/build_db_from_esri.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,13 +734,14 @@ def import_geogcs():

if deprecated and code != latestWkid and code not in ('4305', '4812'): # Voirol 1960 no longer in EPSG
cursor.execute(
"SELECT name FROM geodetic_crs WHERE auth_name = 'EPSG' AND code = ?", (latestWkid,))
"SELECT name, deprecated FROM geodetic_crs WHERE auth_name = 'EPSG' AND code = ?", (latestWkid,))
src_row = cursor.fetchone()
assert src_row, (code, latestWkid)

sql = """INSERT INTO "deprecation" VALUES('geodetic_crs','ESRI','%s','EPSG','%s','ESRI');""" % (
code, latestWkid)
all_sql.append(sql)
_, deprecated = src_row
if not deprecated:
sql = """INSERT INTO "deprecation" VALUES('geodetic_crs','ESRI','%s','EPSG','%s','ESRI');""" % (
code, latestWkid)
all_sql.append(sql)
elif deprecated and code != latestWkid:
mapDeprecatedToNonDeprecated[code] = latestWkid

Expand Down Expand Up @@ -1536,12 +1537,14 @@ def import_projcs():
all_sql.append(sql)
else:
cursor.execute(
"SELECT name FROM projected_crs WHERE auth_name = 'EPSG' AND code = ?", (latestWkid,))
"SELECT name, deprecated FROM projected_crs WHERE auth_name = 'EPSG' AND code = ?", (latestWkid,))
src_row = cursor.fetchone()
assert src_row, row
sql = """INSERT INTO "deprecation" VALUES('projected_crs','ESRI','%s','EPSG','%s','ESRI');""" % (
code, latestWkid)
all_sql.append(sql)
_, deprecated = src_row
if not deprecated:
sql = """INSERT INTO "deprecation" VALUES('projected_crs','ESRI','%s','EPSG','%s','ESRI');""" % (
code, latestWkid)
all_sql.append(sql)


########################
Expand Down Expand Up @@ -1846,13 +1849,14 @@ def import_vertcs():

if deprecated and code != latestWkid:
cursor.execute(
"SELECT name FROM vertical_crs WHERE auth_name = 'EPSG' AND code = ?", (latestWkid,))
"SELECT name, deprecated FROM vertical_crs WHERE auth_name = 'EPSG' AND code = ?", (latestWkid,))
src_row = cursor.fetchone()
assert src_row

sql = """INSERT INTO "deprecation" VALUES('vertical_crs','ESRI','%s','EPSG','%s','ESRI');""" % (
code, latestWkid)
all_sql.append(sql)
_, deprecated = src_row
if not deprecated:
sql = """INSERT INTO "deprecation" VALUES('vertical_crs','ESRI','%s','EPSG','%s','ESRI');""" % (
code, latestWkid)
all_sql.append(sql)
elif deprecated and code != latestWkid:
mapDeprecatedToNonDeprecated[code] = latestWkid

Expand Down

0 comments on commit 9866bef

Please sign in to comment.