Skip to content

Commit d256f1c

Browse files
feat: remove srtm
1 parent a004ce1 commit d256f1c

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

.github/workflows/tests.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ name: tests
33
on: [push, pull_request]
44

55
jobs:
6-
6+
77
tests:
8+
env:
9+
GOOGLE_APPLICATION_CREDENTIALS: /tmp/gcloud_key.json
810
runs-on: ubuntu-latest
911
steps:
1012
- name: Install dependencies
@@ -21,6 +23,8 @@ jobs:
2123
run: |
2224
python -m pip install --upgrade pip
2325
pip install -e ".[test]"
26+
- name: Import GCS key # for rpcm.dem SRTM lookup
27+
run: echo "${{ secrets.GCR_RW_SERVICEACCOUNT_KEY }}" | base64 -d > ${{ env.GOOGLE_APPLICATION_CREDENTIALS }}
2428
- name: Run tests
2529
run: |
2630
pyproj sync -v --file us_nga_egm96_15

s2p/image_coordinates_to_coordinates.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from shapely.geometry import Point
99
import geopy
1010
import geopy.distance
11-
import srtm4
11+
from rpcm.dem import get_srtm_elevations
1212

1313
from rpcm import RPCModel, rpc_from_rpc_file
1414

@@ -37,7 +37,7 @@ def localize_row_col_geometry(
3737
corrected_lons, corrected_lats = [], []
3838
for (lon, lat), col_idx, row_idx in zip(coords, col_indices, row_indices):
3939

40-
new_altitude = srtm4.srtm4(lon, lat)
40+
new_altitude = get_srtm_elevations([lon], [lat], convert_ellipsoidal=True)
4141
new_lon, new_lat = 0, 0
4242
max_iterations = 10
4343
ground_dist_tol = 50
@@ -51,7 +51,7 @@ def localize_row_col_geometry(
5151
new_lon, new_lat = rpc_model.localization(
5252
col_idx, row_idx, new_altitude
5353
)
54-
new_altitude = srtm4.srtm4(new_lon, new_lat)
54+
new_altitude = get_srtm_elevations([new_lon], [new_lat], convert_ellipsoidal=True)
5555
ground_distance = geopy.distance.distance(
5656
(old_lat, old_lon), (new_lat, new_lon)
5757
).m

s2p/rpc_utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from pyproj import CRS
1111
import rpcm
12-
import srtm4
12+
from rpcm.dem import get_srtm_elevations
1313

1414
from s2p import geographiclib
1515
from s2p import common
@@ -198,7 +198,7 @@ def altitude_range(rpc, x, y, w, h, cfg, margin_top=0, margin_bottom=0):
198198
points = [(lon, lat) for lon in np.arange(lon_m, lon_M, s)
199199
for lat in np.arange(lat_m, lat_M, s)]
200200
lons, lats = np.asarray(points).T
201-
alts = srtm4.srtm4(lons, lats) # TODO use srtm4 nn interpolation option
201+
alts = get_srtm_elevations(lons, lats, convert_ellipsoidal=True)
202202
h_m = min(alts) + margin_bottom
203203
h_M = max(alts) + margin_top
204204
else:
@@ -262,7 +262,7 @@ def roi_process(rpc, ll_poly, use_srtm=False, exogenous_dem=None,
262262
if exogenous_dem_geoid_mode is True:
263263
z = geographiclib.geoid_to_ellipsoid(lat, lon, z)
264264
elif use_srtm:
265-
z = srtm4.srtm4(lon, lat)
265+
z = get_srtm_elevations([lon], [lat], convert_ellipsoidal=True)
266266
else:
267267
z = rpc.alt_offset
268268
img_pts = rpc.projection(ll_poly[:, 0], ll_poly[:, 1], z)

setup.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ def finalize_options(self):
5252
'plyflatten>=0.2.0',
5353
'ransac',
5454
'rpcm @ git+https://github.com/20treeAI/[email protected]',
55-
'srtm4',
5655
'requests',
5756
'opencv-python',
5857
'geopandas',
@@ -63,7 +62,7 @@ def finalize_options(self):
6362
}
6463

6564
setup(name="s2p",
66-
version="1.6.7",
65+
version="1.6.8",
6766
description="Satellite Stereo Pipeline.",
6867
long_description=readme(),
6968
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)