-
-
Save maning/18001c4190dc1ba9d3edaba607e1e903 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
# For each file, get bounds of each imagery, download imagery tiles and | |
# create masks/labels. | |
url=ph-temp/url-bld.txt #linedelimited textfile of OAM imagery, for example, http://oin-hotosm.s3.amazonaws.com/590efc68d4280a001030900c/0/ae843ead-f764-4b58-badf-d6f66eff3f3b.tif | |
images=ph-temp/positives-images #path to save images | |
masks=ph-temp/positives-masks #path to save masks | |
maskpoly=ph-temp/arc-buildings.geojson #polygon to rasterize | |
while read line || [[ -n "$line" ]]; do | |
#echo get bounds $line, ${line##*/}.geojson ... | |
rio bounds $line > ${line##*/}.geojson | |
echo clipping to negative polys ... | |
ogr2ogr -f GeoJSON -clipsrc ${line##*/}.geojson ${line##*/}_clip.geojson $maskpoly | |
echo get list of tiles ... | |
./rs cover --zoom 21 ${line##*/}_clip.geojson ${line##*/}.tiles | |
x=$(echo "$line" | cut -c 36- | cut -d'.' -f 1) | |
echo Getting tiles $x ... | |
./rs download "https://tiles.openaerialmap.org/"$x"/{z}/{x}/{y}.png" \ | |
${line##*/}.tiles $images | |
echo Getting masks $x ... | |
#./rs rasterize --dataset config/dataset-building.toml --zoom 21 --size 256 \ | |
ph-temp/arc-buildings.geojson ${line##*/}.tiles $masks | |
done < "$url" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment