Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Daniel Scheffler
py_tools_ds
Commits
a691dc4c
Commit
a691dc4c
authored
May 08, 2021
by
Daniel Scheffler
Browse files
Fixed syntax.
Signed-off-by:
Daniel Scheffler
<
danschef@gfz-potsdam.de
>
parent
ff9fa33d
Pipeline
#22784
failed with stage
in 1 minute and 46 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
py_tools_ds/geo/raster/conversion.py
View file @
a691dc4c
...
...
@@ -54,7 +54,8 @@ def raster2polygon(array, gt, prj, DN2extract=1, exact=True, maxfeatCount=None,
# downsample with nearest neighbour
zoom_factor
=
(
8000
*
8000
/
array
.
size
)
**
0.5
array
,
gt
,
prj
=
warp_ndarray
(
array
,
gt
,
prj
,
out_gsd
=
(
gt
[
1
]
/
zoom_factor
,
gt
[
5
]
/
zoom_factor
),
out_gsd
=
(
gt
[
1
]
/
zoom_factor
,
gt
[
5
]
/
zoom_factor
),
rspAlg
=
'near'
,
q
=
True
)
...
...
@@ -85,7 +86,11 @@ def raster2polygon(array, gt, prj, DN2extract=1, exact=True, maxfeatCount=None,
if
progress
and
not
q
else
Timer
(
timeout
,
use_as_callback
=
True
)
if
timeout
else
None
# run the algorithm
status
=
gdal
.
Polygonize
(
src_band
,
src_band
.
GetMaskBand
(),
mem_layer
,
0
,
[
"8CONNECTED=8"
]
if
exact
else
[],
status
=
gdal
.
Polygonize
(
src_band
,
src_band
.
GetMaskBand
(),
mem_layer
,
0
,
[
"8CONNECTED=8"
]
if
exact
else
[],
callback
=
callback
)
# handle exit status other than 0 (fail)
...
...
@@ -95,6 +100,9 @@ def raster2polygon(array, gt, prj, DN2extract=1, exact=True, maxfeatCount=None,
raise
TimeoutError
(
'raster2polygon timed out!'
)
raise
Exception
(
errMsg
)
except
KeyboardInterrupt
:
raise
TimeoutError
(
'raster2polygon timed out!'
)
# extract polygon
mem_layer
.
SetAttributeFilter
(
'DN = %s'
%
DN2extract
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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