Commit bfdbe667 authored by Mario Chirinos Colunga's avatar Mario Chirinos Colunga 💬

parallel

parent bd126ebf
...@@ -89,3 +89,11 @@ L2AProductListExtractData.sh /home/geoint/NAS/sentinelImages/ /home/geoint/senti ...@@ -89,3 +89,11 @@ L2AProductListExtractData.sh /home/geoint/NAS/sentinelImages/ /home/geoint/senti
``` ```
## Merge Images Within a Polygon by Date (`MergeByDate.sh`)
This script uses `gdal_merge.py` and `gdal_translate` to merge all the images within a directory and to crop the result using the bounding box of the input polygon.
### Example
```bash
MergeByDate.sh /home/geoint/NAS/images/
```
#!/bin/sh
JP2DIR=$1 #JP2 Directory
POLYGON=$2 #Crop Window
BOX=$(python3 polygonToBox.py "$POLYGON")
cd $JP2DIR
for f in *; do
if [ -d ${f} ]; then
cd $f
if [ ! -e ../$f".tif" ]; then
echo "gdal_merge.py -o ../"$f".tif" $(ls *.jp2)
gdal_merge.py -o ../$f".tif" $(ls *.jp2)
fi
cd ..
if [ ! -e ../$f".jp2" ]; then
gdal_translate -projwin $BOX -projwin_srs WGS84 -ot Byte -of JPEG $f".tif" $f".jp2"
fi
rasterWkt.py "$POLYGON" $f.jp2 $f"_p.tif"
echo $f
fi
done
cd $JP2DIR
find . -name *.xml -type f -delete
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment