Skip to content

Commit

Permalink
fixes for get_srs_info
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewAnnex committed Apr 17, 2022
1 parent 8a009c2 commit 1c0c78b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions asap_stereo/asap.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,12 @@ def get_srs_info(img, use_eqc: str = None)-> str:
if use_eqc:
print(f'Using user provided projection {use_eqc}')
return use_eqc
proj4str = sh.gdalsrsinfo(str(img), o='proj4')
if len(proj4str) <= 10: # arbitrary length picked here
try:
proj4str = sh.gdalsrsinfo(str(img), o='proj4')
except sh.ErrorReturnCode_1 as e:
out_dict = CommonSteps.get_cam_info(img)
lon = (float(out_dict['UniversalGroundRange']['MinimumLongitude']) + float(out_dict['UniversalGroundRange']['MaximumLongitude'])) / 2
# todo keep using sinu?
proj4str = f"+proj=sinu +lon_0={lon} +x_0=0 +y_0=0 +a={out_dict['Target']['RadiusA']} +b={out_dict['Target']['RadiusB']} +units=m +no_defs"
return str(proj4str).rstrip('\n\' ').lstrip('\'')

Expand Down

0 comments on commit 1c0c78b

Please sign in to comment.