Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
De Boissieu Florian
moringa
Commits
0b075e1d
Commit
0b075e1d
authored
Nov 20, 2018
by
Gaetano Raffaele
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIX: Workaround for L8 south hemisphere / north projection issue.
parent
f242ed2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
coregister.py
coregister.py
+12
-7
No files found.
coregister.py
View file @
0b075e1d
...
...
@@ -30,11 +30,11 @@ def main(argv):
src
=
args
[
1
]
ds
=
gdal
.
Open
(
args
[
1
])
#
prj = ds.GetProjection()
prj
=
ds
.
GetProjection
()
gt
=
ds
.
GetGeoTransform
()
#
srs = osr.SpatialReference()
#
srs.ImportFromWkt(prj)
#
code = srs.GetAuthorityCode(None)
srs
=
osr
.
SpatialReference
()
srs
.
ImportFromWkt
(
prj
)
code
=
srs
.
GetAuthorityCode
(
None
)
gsp
=
str
(
int
(
2
*
round
(
max
(
abs
(
gt
[
1
]),
abs
(
gt
[
5
])))))
ds
=
None
...
...
@@ -105,7 +105,7 @@ def main(argv):
homo_sample_rate
=
float
(
maxgcp
)
/
float
(
npts
)
homoGeo2Pixel
(
tmpfld
+
'homo.txt'
,
args
[
1
],
tmpfld
+
'homocorr.txt'
,
sample_rate
=
homo_sample_rate
)
cmd
=
[
'otbcli_GenerateRPCSensorModel'
,
'-inpoints'
,
tmpfld
+
'homocorr.txt'
,
'-outgeom'
,
tmphomo
]
cmd
=
[
'otbcli_GenerateRPCSensorModel'
,
'-inpoints'
,
tmpfld
+
'homocorr.txt'
,
'-outgeom'
,
tmphomo
,
'-map'
,
'epsg'
,
'map.epsg.code'
,
'4326'
]
subprocess
.
call
(
cmd
,
shell
=
sh
)
# Remove Cartographic Information from source (temporary)
...
...
@@ -116,7 +116,12 @@ def main(argv):
ds
.
SetProjection
(
''
)
ds
=
None
cmd
=
[
'otbcli_OrthoRectification'
,
'-io.in
\"
'
+
args
[
1
]
+
'?&geom='
+
tmphomo
+
'
\"
'
,
'-io.out'
,
tmpfld
+
'sits_band_coreg.tif'
,
'uint16'
,
'-map'
,
'epsg'
,
'-map.epsg.code'
,
'4326'
,
'-opt.gridspacing'
,
gsp
]
tmp_code
=
code
# Workaround for southern hemisphere images with NORTH projection
if
tmp_code
.
startswith
(
'326'
)
and
gt
[
3
]
<
0
:
warnings
.
warn
(
"Original image is in southern hemisphere with north UTM projection. Using south projection for temporary output."
)
tmp_code
=
tmp_code
[
0
:
2
]
+
'7'
+
tmp_code
[
3
:]
cmd
=
[
'otbcli_OrthoRectification'
,
'-io.in
\"
'
+
args
[
1
]
+
'?&geom='
+
tmphomo
+
'
\"
'
,
'-io.out'
,
tmpfld
+
'sits_band_coreg.tif'
,
'uint16'
,
'-map'
,
'epsg'
,
'-map.epsg.code'
,
tmp_code
,
'-opt.gridspacing'
,
gsp
]
cmdex
=
' '
.
join
(
cmd
)
subprocess
.
call
(
cmdex
,
shell
=
True
)
...
...
@@ -144,7 +149,7 @@ def main(argv):
ds
.
SetProjection
(
''
)
ds
=
None
cmd
=
[
'otbcli_OrthoRectification'
,
'-io.in
\"
'
+
f
+
'?&geom='
+
tmphomo
+
'
\"
'
,
'-io.out'
,
tmpfld
+
fn
[
0
]
+
'_coreg.tif'
,
'uint8'
,
'-map'
,
'epsg'
,
'-map.epsg.code'
,
'4326'
,
'-opt.gridspacing'
,
gsp
,
'-interpolator nn'
]
cmd
=
[
'otbcli_OrthoRectification'
,
'-io.in
\"
'
+
f
+
'?&geom='
+
tmphomo
+
'
\"
'
,
'-io.out'
,
tmpfld
+
fn
[
0
]
+
'_coreg.tif'
,
'uint8'
,
'-map'
,
'epsg'
,
'-map.epsg.code'
,
tmp_code
,
'-opt.gridspacing'
,
gsp
,
'-interpolator nn'
]
cmdex
=
' '
.
join
(
cmd
)
subprocess
.
call
(
cmdex
,
shell
=
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment