Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
GeoSentinel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoSentinel
Commits
de49e1e1
Commit
de49e1e1
authored
May 23, 2018
by
Mario Chirinos Colunga
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndvi sh p3
parent
0241d74a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
14 deletions
+36
-14
polygonToBox.py
geosentinel/polygonToBox.py
+34
-0
productListToNDVI.sh
tools/productListToNDVI.sh
+2
-14
No files found.
geosentinel/polygonToBox.py
0 → 100644
View file @
de49e1e1
#!/usr/bin/python
# -*- coding: utf-8 -*-
from
osgeo
import
ogr
def
getWKTPolygonBoundingBox
(
polygon
):
'''!
Get the bounding box of a WKT polygon.
@param polygon: WKT polygon
@return bounding box string in format ulx uly lrx lry
>>> g = getWKTPolygonBoundingBox("POLYGON((-89.96360136135893 20.754157792347172,-89.24078398227726 20.754157792347172,-89.24078398227726 21.295577631081912,-89.96360136135893 21.295577631081912,-89.96360136135893 20.754157792347172))")
>>> print (g)
-89.96360136135893 21.295577631081912 -89.24078398227726 20.754157792347172
'''
box
=
ogr
.
CreateGeometryFromWkt
(
polygon
)
.
GetEnvelope
()
#(minX, maxX, minY, maxY)
ulx
=
box
[
0
]
uly
=
box
[
3
]
lrx
=
box
[
1
]
lry
=
box
[
2
]
# ulx uly lrx lry
return
str
(
ulx
)
+
" "
+
str
(
uly
)
+
" "
+
str
(
lrx
)
+
" "
+
str
(
lry
)
def
main
(
argv
):
getWKTPolygonBoundingBox
(
argv
[
1
])
if
__name__
==
"__main__"
:
main
(
sys
.
argv
)
#g = getWKTPolygonBoundingBox("POLYGON((-89.96360136135893 20.754157792347172,-89.24078398227726 20.754157792347172,-89.24078398227726 21.295577631081912,-89.96360136135893 21.295577631081912,-89.96360136135893 20.754157792347172))")
#print (g)
tools/productListToNDVI.sh
View file @
de49e1e1
...
...
@@ -30,17 +30,6 @@ do
echo
"NIR-"
$NIR
echo
"VIR-"
$VIR
# if [ ! -e $filepattern"04.jpg" ]; then
# gdal_translate -projwin $3 -projwin_srs WGS84 -ot Byte -scale 0 4096 0 255 -of JPEG $NIR ndvi/$filepattern"04.jpg"
# fi
# if [ ! -e $filepattern"08jpg" ]; then
# gdal_translate -projwin $3 -projwin_srs WGS84 -ot Byte -scale 0 4096 0 255 -of JPEG $VIR ndvi/$filepattern"08.jpg"
# fi
if
[
!
-d
"ndvi"
]
;
then
mkdir
ndvi
fi
...
...
@@ -49,13 +38,12 @@ do
fileout2
=
$(
echo
$filepattern
|
cut
-d
"_"
-f2
)
python3
$HOME
/git/GeoSentinel/geosentinel/ndvi.py
$NIR
$VIR
ndvi/
$fileout2
"_"
$fileout1
".tiff"
# convert $filepattern"04.jpg" $filepattern"03.jpg" $filepattern"02.jpg" -resize 640x480\! -combine video/$fileout2"_"$fileout1".jpg"
if
[
!
-d
"video"
]
;
then
mkdir
video
fi
gdal_translate
-projwin
$
3
-projwin_srs
WGS84
-ot
Byte
-scale
0 4096 0 255
-of
JPEG ndvi/
$fileout2
"_"
$fileout1
".tiff"
video/
$fileout2
"_"
$fileout1
".jpg"
BOX
=
$(
python3
"
$HOME
/git/GeoSentinel/geosentinel/getWKTPolygonBoundingBox.py"
$3
)
gdal_translate
-projwin
$
BOX
-projwin_srs
WGS84
-ot
Byte
-scale
0 4096 0 255
-of
JPEG ndvi/
$fileout2
"_"
$fileout1
".tiff"
video/
$fileout2
"_"
$fileout1
".jpg"
cd
..
...
...
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