aboutsummaryrefslogtreecommitdiff
path: root/scripts/build_db_from_esri.py
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-04-25 23:38:37 +0200
committerEven Rouault <even.rouault@spatialys.com>2020-04-26 12:23:18 +0200
commit1750bb74c1740dd9be0d88fef41d328023460bb2 (patch)
tree2eb11a86eb6114eb348fcf70e9792a9642940616 /scripts/build_db_from_esri.py
parentfa55e657d14ef9468d80a07fb73a8b25a3d86244 (diff)
downloadPROJ-1750bb74c1740dd9be0d88fef41d328023460bb2.tar.gz
PROJ-1750bb74c1740dd9be0d88fef41d328023460bb2.zip
Database: map more ESRI grid names
Diffstat (limited to 'scripts/build_db_from_esri.py')
-rwxr-xr-xscripts/build_db_from_esri.py44
1 files changed, 31 insertions, 13 deletions
diff --git a/scripts/build_db_from_esri.py b/scripts/build_db_from_esri.py
index 500dc5d0..de70b638 100755
--- a/scripts/build_db_from_esri.py
+++ b/scripts/build_db_from_esri.py
@@ -58,6 +58,33 @@ date = '2019-12-01'
all_sql.append(
"""INSERT INTO "metadata" VALUES('ESRI.DATE', '%s');""" % (date))
+manual_grids = """------------------
+-- ESRI grid names
+------------------
+INSERT INTO grid_alternatives(original_grid_name,
+ proj_grid_name,
+ old_proj_grid_name,
+ proj_grid_format,
+ proj_method,
+ inverse_direction,
+ package_name,
+ url, direct_download, open_license, directory)
+VALUES
+('prvi','us_noaa_prvi.tif','prvi','GTiff','hgridshift',0,NULL,'https://cdn.proj.org/us_noaa_prvi.tif', 1, 1, NULL),
+('portugal/DLX_ETRS89_geo','pt_dgt_DLx_ETRS89_geo.tif','DLX_ETRS89_geo.gsb','GTiff','hgridshift',0,NULL,'https://cdn.proj.org/pt_dgt_DLx_ETRS89_geo.tif',1,1,NULL),
+('portugal/D73_ETRS89_geo','pt_dgt_D73_ETRS89_geo.tif','D73_ETRS89_geo.gsb','GTiff','hgridshift',0,NULL,'https://cdn.proj.org/pt_dgt_D73_ETRS89_geo.tif',1,1,NULL),
+('netherlands/rdtrans2008','','rdtrans2008.gsb','NTv2','hgridshift',0,NULL,'https://salsa.debian.org/debian-gis-team/proj-rdnap/raw/upstream/2008/rdtrans2008.gsb',1,0,NULL),
+('uk/OSTN15_NTv2','uk_os_OSTN15_NTv2_OSGBtoETRS.tif','OSTN15_NTv2_OSGBtoETRS.gsb','GTiff','hgridshift',1 -- reverse direction
+ ,NULL,'https://cdn.proj.org/uk_os_OSTN15_NTv2_OSGBtoETRS.tif',1,1,NULL),
+('canada/GS7783','ca_nrc_GS7783.tif','GS7783.GSB','GTiff','hgridshift',0,NULL,'https://cdn.proj.org/ca_nrc_GS7783.tif',1,1,NULL),
+('c1hpgn', 'us_noaa_c1hpgn.tif', 'c1hpgn.gsb', 'GTiff', 'hgridshift', 0, NULL, 'https://cdn.proj.org/us_noaa_c1hpgn.tif', 1, 1, NULL),
+('c2hpgn', 'us_noaa_c2hpgn.tif', 'c2hpgn.gsb', 'GTiff', 'hgridshift', 0, NULL, 'https://cdn.proj.org/us_noaa_c2hpgn.tif', 1, 1, NULL),
+('spain/100800401','es_cat_icgc_100800401.tif','100800401.gsb','GTiff','hgridshift',0,NULL,'https://cdn.proj.org/es_cat_icgc_100800401.tif',1,1,NULL),
+('australia/QLD_0900','au_icsm_National_84_02_07_01.tif','National_84_02_07_01.gsb','GTiff','hgridshift',0,NULL,'https://cdn.proj.org/au_icsm_National_84_02_07_01.tif',1,1,NULL) -- From https://www.dnrme.qld.gov.au/__data/assets/pdf_file/0006/105765/gday-21-user-guide.pdf: "Note that the Queensland grid QLD_0900.gsb produces identical results to the National AGD84 grid for the equivalent coverage."
+;
+-- 'france/RGNC1991_IGN72GrandeTerre' : we have a 3D geocentric corresponding one: no need for mapping
+-- 'france/RGNC1991_NEA74Noumea' : we have a 3D geocentric corresponding one: no need for mapping
+"""
def escape_literal(x):
return x.replace("'", "''")
@@ -1567,20 +1594,10 @@ def import_geogtran():
wkid, esri_name, src_crs_auth_name, src_crs_code, dst_crs_auth_name, dst_crs_code, area_auth_name, area_code, accuracy, filename, deprecated)
all_sql.append(sql)
- if filename in ('c1hpgn', 'c2hpgn'):
- tiff_filename = 'us_noaa_' + filename + '.tif'
- sql = """INSERT INTO grid_alternatives VALUES ('%s', '%s', '%s', 'GTiff', 'hgridshift', 0, NULL, '%s', 1, 1, NULL);""" % (
- filename, tiff_filename, filename + '.gsb', 'https://cdn.proj.org/' + tiff_filename)
- all_sql.append(sql)
- elif filename == 'wohpgn':
- tiff_filename = 'us_noaa_' + filename + '.tif'
- sql = """INSERT INTO grid_alternatives VALUES ('%s', '%s', '%s', 'GTiff', 'hgridshift', , NULL, '%s', 1, 1, NULL);""" % (
- filename, tiff_filename, 'WO', 'https://cdn.proj.org/' + tiff_filename)
- all_sql.append(sql)
- elif filename == 'prvi':
- continue
- else:
+ global manual_grids
+ if ("'" + filename + "'") not in manual_grids:
print('not handled grid: ' + filename)
+ manual_grids += "-- '" + filename + "': no mapping\n"
import_linunit()
@@ -1601,6 +1618,7 @@ f = open(os.path.join(sql_dir_name, 'esri') + '.sql', 'wb')
f.write("--- This file has been generated by scripts/build_db_from_esri.py. DO NOT EDIT !\n\n".encode('UTF-8'))
for sql in all_sql:
f.write((sql + '\n').encode('UTF-8'))
+f.write(manual_grids.encode('UTF-8'))
f.close()
print('')