Skip to content

Commit 73575dc

Browse files
committed
tinshift: support TIN GeoPackage files
Such files are equivalent to already supported TIN JSON files, but scale better for arbitrarily large triangulations, in particular for network-based access. The format is defined in source/specifications/tin_gpkg.rst and the https://github.com/OSGeo/PROJ-data/blob/master/grid_tools/tin_json_to_gpkg_tin.py Python script may be used o convert an existing TIN JSON into a TIN GeoPackage.
1 parent c6a3dd1 commit 73575dc

39 files changed

+1836
-104
lines changed

.github/workflows/fedora_rawhide/start.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ ctest -j$(nproc)
2626

2727
# Try EMBED_RESOURCE_DIRECTORY option
2828
wget https://raw.githubusercontent.com/OSGeo/PROJ-data/refs/heads/master/us_nga/us_nga_egm96_15.tif
29+
wget https://cdn.proj.org/fi_nls_ykj_etrs35fin.gpkg
2930
mkdir grids
3031
mv us_nga_egm96_15.tif grids
32+
mv fi_nls_ykj_etrs35fin.gpkg grids
3133
echo "Build with -DEMBED_RESOURCE_FILES=ON -DEMBED_RESOURCE_DIRECTORY=$PWD/grids"
3234
CC=clang CXX=clang++ cmake .. -DEMBED_RESOURCE_DIRECTORY=$PWD/grids
3335
make -j$(nproc)
@@ -36,6 +38,8 @@ echo 49 2 0 | bin/cs2cs "WGS84 + EGM96 height" EPSG:4979
3638
echo 49 2 0 | bin/cs2cs "WGS84 + EGM96 height" EPSG:4979 | grep 44.643 >/dev/null || (echo "Expected 49dN 2dE 44.643 as a result" && /bin/false)
3739
echo 0 0 0 | bin/cct +init=ITRF2000:ITRF96
3840
echo 0 0 0 | bin/cct +init=ITRF2000:ITRF96 | grep 0.0067 >/dev/null || (echo "Expected 0.0067 0.0061 -0.0185 as a result" && /bin/false)
41+
echo 3432087 6995748 0 | bin/cct +proj=tinshift +file=fi_nls_ykj_etrs35fin.gpkg
42+
echo 3432087 6995748 0 | bin/cct +proj=tinshift +file=fi_nls_ykj_etrs35fin.gpkg | grep 431943.0905 >/dev/null || (echo "Expected 431943.0905 6992816.7826 0 as a result" && /bin/false)
3943

4044
echo "Build with -DEMBED_RESOURCE_FILES=ON -DEMBED_RESOURCE_DIRECTORY=$PWD/grids -DUSE_ONLY_EMBEDDED_RESOURCE_FILES=ON"
4145
CC=clang CXX=clang++ cmake .. -DEMBED_RESOURCE_DIRECTORY=$PWD/grids -DUSE_ONLY_EMBEDDED_RESOURCE_FILES=ON

.github/workflows/windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
shell: cmd
5656
if: steps.cache.outputs.cache-hit != 'true'
5757
run: |
58-
vcpkg install sqlite3[core,tool] tiff curl --triplet=${{ env.ARCH }}-windows
58+
vcpkg install sqlite3[core,tool,rtree] tiff curl --triplet=${{ env.ARCH }}-windows
5959
6060
- name: Build
6161
shell: cmd

appveyor.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,12 @@ branches:
55
environment:
66
matrix:
77

8-
# VS 2015
8+
# VS 2017
99
- platform: x86
1010
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
1111
BUILD_SHARED_LIBS: OFF
1212
CMAKE_GENERATOR: Ninja
1313

14-
# VS 2017
15-
# - platform: x64
16-
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
17-
# BUILD_SHARED_LIBS: ON
18-
# CMAKE_GENERATOR: Ninja
19-
2014
shallow_clone: true
2115

2216
cache:
@@ -28,13 +22,12 @@ build_script:
2822
- set VCPKG_DEFAULT_TRIPLET=%platform%-windows
2923
- set VCPKG_DEFAULT_HOST_TRIPLET=%platform%-windows
3024
# If cached directory does not exist, update vcpkg and install dependencies
31-
# The checkout of a precise sha1 for VS2015 is a workaround for https://github.com/microsoft/vcpkg/issues/11666
3225
- if not exist %VCPKG_INSTALLED%\bin (
3326
cd "%VCPKG_ROOT%" &
34-
git fetch --depth=1 origin 2023.04.15 &
27+
git fetch --depth=1 origin master &
3528
(if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" (git -c advice.detachedHead=false checkout FETCH_HEAD)) &
3629
.\bootstrap-vcpkg.bat -disableMetrics &
37-
vcpkg install sqlite3[core,tool] tiff curl --triplet=%platform%-windows &
30+
vcpkg install sqlite3[core,tool,rtree] tiff curl --triplet=%platform%-windows &
3831
cd %APPVEYOR_BUILD_FOLDER%
3932
)
4033
- dir %VCPKG_INSTALLED%\bin

data/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ set(ALL_SQL_IN "${CMAKE_CURRENT_BINARY_DIR}/all.sql.in")
3131
set(PROJ_DB "${CMAKE_CURRENT_BINARY_DIR}/proj.db")
3232
include(sql_filelist.cmake)
3333

34-
set(PROJ_DB_SQL_EXPECTED_MD5 "740a1a99e9182f90233102e3745d3dfd")
34+
set(PROJ_DB_SQL_EXPECTED_MD5 "dc586d3a630e2db81c46ecbb5da93647")
3535

3636
add_custom_command(
3737
OUTPUT ${PROJ_DB}

data/sql/grid_alternatives.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ VALUES
183183
('fi_nls_n43_n60.json','fi_nls_n43_n60.json',NULL,'JSON','tinshift',0,NULL,'https://cdn.proj.org/fi_nls_n43_n60.json',1,1,NULL),
184184
('fi_nls_n60_n2000.json','fi_nls_n60_n2000.json',NULL,'JSON','tinshift',0,NULL,'https://cdn.proj.org/fi_nls_n60_n2000.json',1,1,NULL),
185185
('fi_nls_ykj_etrs35fin.json','fi_nls_ykj_etrs35fin.json',NULL,'JSON','tinshift',0,NULL,'https://cdn.proj.org/fi_nls_ykj_etrs35fin.json',1,1,NULL),
186+
('NOT-YET-IN-GRID-TRANSFORMATION-fi_nls_n43_n60.gpkg','fi_nls_n43_n60.gpkg',NULL,'GPKG','tinshift',0,NULL,'https://cdn.proj.org/fi_nls_n43_n60.gpkg',1,1,NULL),
187+
('NOT-YET-IN-GRID-TRANSFORMATION-fi_nls_n60_n2000.gpkg','fi_nls_n60_n2000.gpkg',NULL,'GPKG','tinshift',0,NULL,'https://cdn.proj.org/fi_nls_n60_n2000.gpkg',1,1,NULL),
188+
('NOT-YET-IN-GRID-TRANSFORMATION-fi_nls_ykj_etrs35fin.gpkg','fi_nls_ykj_etrs35fin.gpkg',NULL,'GPKG','tinshift',0,NULL,'https://cdn.proj.org/fi_nls_ykj_etrs35fin.gpkg',1,1,NULL),
186189

187190
-- fr_ign - IGN France
188191
('rgf93_ntf.gsb','fr_ign_ntf_r93.tif','ntf_r93.gsb','GTiff','hgridshift',1,NULL,'https://cdn.proj.org/fr_ign_ntf_r93.tif',1,1,NULL),

data/sql/proj_db_table_defs.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ CREATE TABLE grid_alternatives(
896896
original_grid_name TEXT NOT NULL PRIMARY KEY, -- original grid name (e.g. Und_min2.5x2.5_egm2008_isw=82_WGS84_TideFree.gz). For LOS/LAS format, the .las files
897897
proj_grid_name TEXT NOT NULL, -- PROJ >= 7 grid name (e.g us_nga_egm08_25.tif)
898898
old_proj_grid_name TEXT, -- PROJ < 7 grid name (e.g egm08_25.gtx)
899-
proj_grid_format TEXT NOT NULL, -- 'GTiff', 'GTX', 'NTv2', JSON
899+
proj_grid_format TEXT NOT NULL, -- 'GTiff', 'GTX', 'NTv2', 'JSON', 'GPKG'
900900
proj_method TEXT NOT NULL, -- gridshift, hgridshift, vgridshift, geoid_like, geocentricoffset, tinshift or velocity_grid
901901
inverse_direction BOOLEAN NOT NULL CHECK (inverse_direction IN (0, 1)), -- whether the PROJ grid direction is reversed w.r.t to the authority one (TRUE in that case)
902902
package_name TEXT, -- no longer used. Must be NULL
@@ -906,14 +906,14 @@ CREATE TABLE grid_alternatives(
906906
directory TEXT, -- optional directory where the file might be located
907907

908908
CONSTRAINT fk_grid_alternatives_grid_packages FOREIGN KEY (package_name) REFERENCES grid_packages(package_name) ON DELETE CASCADE,
909-
CONSTRAINT check_grid_alternatives_grid_fromat CHECK (proj_grid_format IN ('GTiff', 'GTX', 'NTv2', 'JSON')),
909+
CONSTRAINT check_grid_alternatives_grid_fromat CHECK (proj_grid_format IN ('GTiff', 'GTX', 'NTv2', 'JSON', 'GPKG')),
910910
CONSTRAINT check_grid_alternatives_proj_method CHECK (proj_method IN ('gridshift', 'hgridshift', 'vgridshift', 'geoid_like', 'geocentricoffset', 'tinshift', 'velocity_grid', 'defmodel')),
911911
CONSTRAINT check_grid_alternatives_inverse_direction CHECK (NOT(proj_method = 'geoid_like' AND inverse_direction = 1)),
912912
CONSTRAINT check_grid_alternatives_package_name CHECK (package_name IS NULL),
913913
CONSTRAINT check_grid_alternatives_direct_download_url CHECK (NOT(direct_download IS NULL AND url IS NOT NULL)),
914914
CONSTRAINT check_grid_alternatives_open_license_url CHECK (NOT(open_license IS NULL AND url IS NOT NULL)),
915915
CONSTRAINT check_grid_alternatives_constraint_cdn CHECK (NOT(url LIKE 'https://cdn.proj.org/%' AND (direct_download = 0 OR open_license = 0 OR url != 'https://cdn.proj.org/' || proj_grid_name))),
916-
CONSTRAINT check_grid_alternatives_tinshift CHECK ((proj_grid_format != 'JSON' AND proj_method != 'tinshift') OR (proj_grid_format = 'JSON' AND proj_method = 'tinshift'))
916+
CONSTRAINT check_grid_alternatives_tinshift CHECK ((proj_grid_format NOT IN ('JSON','GPKG') AND proj_method != 'tinshift') OR (proj_grid_format IN ('JSON', 'GPKG') AND proj_method = 'tinshift'))
917917
) WITHOUT ROWID;
918918

919919
CREATE INDEX idx_grid_alternatives_proj_grid_name ON grid_alternatives(proj_grid_name);
22 KB
Binary file not shown.

data/tests/tinshift_empty_file.gpkg

Whitespace-only changes.
21 KB
Binary file not shown.
21 KB
Binary file not shown.

0 commit comments

Comments
 (0)