diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-01-06 23:43:09 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-01-07 12:17:14 +0100 |
| commit | 3078c6b90fef0dbd88b6884f4d94ade605b0c4ca (patch) | |
| tree | 0a546228568c62d498d196058271cc5939e10de7 /scripts | |
| parent | 699b92250a90e5c333572245cf3d09c9e00e50e5 (diff) | |
| download | PROJ-3078c6b90fef0dbd88b6884f4d94ade605b0c4ca.tar.gz PROJ-3078c6b90fef0dbd88b6884f4d94ade605b0c4ca.zip | |
Database: fill alias_name with EPSG aliases for CRS
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/build_db.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/build_db.py b/scripts/build_db.py index dbb1c727..05f9a9a9 100755 --- a/scripts/build_db.py +++ b/scripts/build_db.py @@ -561,6 +561,33 @@ def fill_alias(proj_db_cursor): else: print('Cannot find datum %s in geodetic_datum or vertical_datum' % (code)) + proj_db_cursor.execute("SELECT object_code, alias FROM epsg.epsg_alias WHERE object_table_name = 'epsg_coordinatereferencesystem'") + for row in proj_db_cursor.fetchall(): + code, alt_name = row + if int(code) > 60000000: + continue + proj_db_cursor.execute('SELECT 1 FROM geodetic_crs WHERE code = ?', (code,)) + if proj_db_cursor.fetchone() is not None: + proj_db_cursor.execute("INSERT INTO alias_name VALUES ('geodetic_crs','EPSG',?,?,'EPSG')", (code, alt_name)) + continue + + proj_db_cursor.execute('SELECT 1 FROM projected_crs WHERE code = ?', (code,)) + if proj_db_cursor.fetchone() is not None: + proj_db_cursor.execute("INSERT INTO alias_name VALUES ('projected_crs','EPSG',?,?,'EPSG')", (code, alt_name)) + continue + + proj_db_cursor.execute('SELECT 1 FROM vertical_crs WHERE code = ?', (code,)) + if proj_db_cursor.fetchone() is not None: + proj_db_cursor.execute("INSERT INTO alias_name VALUES ('vertical_crs','EPSG',?,?,'EPSG')", (code, alt_name)) + continue + + proj_db_cursor.execute('SELECT 1 FROM compound_crs WHERE code = ?', (code,)) + if proj_db_cursor.fetchone() is not None: + proj_db_cursor.execute("INSERT INTO alias_name VALUES ('compound_crs','EPSG',?,?,'EPSG')", (code, alt_name)) + continue + + print('Cannot find CRS %s in geodetic_crs, projected_crs, vertical_crs or compound_crs' % (code)) + def find_table(proj_db_cursor, code): for table_name in ('helmert_transformation', 'grid_transformation', 'concatenated_operation', 'geodetic_crs', 'projected_crs', 'vertical_crs', 'compound_crs'): |
