-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathget-data
executable file
·76 lines (53 loc) · 2.78 KB
/
get-data
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
DATA_TILE_DIR="/root/map1/data/tiles"
SQLITE_TILE_DIR="$DATA_TILE_DIR/sqlite"
DEM_TILE_DIR="$DATA_TILE_DIR/srtm"
SQLITE_DATA_CACHE_SIZE=10000000000 #10GB
ASTER_DATA_CACHE_SIZE=10000000000 #10GB
MARGIN_LAT_SIZE=0.05
MARGIN_LON_SIZE=0.15
LON_START=$(./extract-aster/x2lon $1 8)
LAT_START=$(./extract-aster/y2lat $(($2 + 1)) 8)
LON_END=$(./extract-aster/x2lon $(($1 + 1)) 8)
LAT_END=$(./extract-aster/y2lat $2 8)
LON_START_TMP=$LON_START
LON_START=$(bc -l <<< "$LON_START-($LON_END - $LON_START_TMP)*$MARGIN_LON_SIZE")
LAT_START_TMP=$LAT_START
LAT_START=$(bc -l <<< "$LAT_START-($LAT_END - $LAT_START_TMP)*$MARGIN_LAT_SIZE")
LON_END=$(bc -l <<< "$LON_END + ($LON_END - $LON_START_TMP)*$MARGIN_LON_SIZE")
LAT_END=$(bc -l <<< "$LAT_END + ($LAT_END - $LAT_START_TMP)*$MARGIN_LAT_SIZE")
LON_START=$(echo $LON_START | sed -E 's/^\.(.+)/0.\1/')
LON_START=$(echo $LON_START | sed -E 's/^-\.(.+)/-0.\1/')
LON_END=$(echo $LON_END | sed -E 's/^\.(.+)/0.\1/')
LON_END=$(echo $LON_END | sed -E 's/^-\.(.+)/-0.\1/')
LAT_START=$(echo $LAT_START | sed -E 's/^\.(.+)/0.\1/')
LAT_START=$(echo $LAT_START | sed -E 's/^-\.(.+)/-0.\1/')
LAT_END=$(echo $LAT_END | sed -E 's/^\.(.+)/0.\1/')
LAT_END=$(echo $LAT_END | sed -E 's/^-\.(.+)/-0.\1/')
mkdir -p $DEM_TILE_DIR
while [ $(du -s "$DEM_TILE_DIR" | cut -f1) -gt "$ASTER_DATA_CACHE_SIZE" ]; do
rm -f $(ls -tr $DEM_TILE_DIR/*.contours.shp | head -n 1)
rm -f $(ls -tr $DEM_TILE_DIR/*.contours.shx | head -n 1)
rm -f $(ls -tr $DEM_TILE_DIR/*.contours.prj | head -n 1)
rm -f $(ls -tr $DEM_TILE_DIR/*.contours.dbf | head -n 1)
rm -f $(ls -tr $DEM_TILE_DIR/*.hillshade.tif | head -n 1)
done
set -e
if [ ! -f "$DEM_TILE_DIR/~$1.$2.contours.shp" ]; then
bunzip2 -ck "$DEM_TILE_DIR/$1.$2.tif.bz2" > /tmp/~$1.$2.aster.tif
gdal_translate -a_srs EPSG:4326 -a_nodata -32768 /tmp/~$1.$2.aster.tif /tmp/~$1.$2.aster.tif~
unlink /tmp/~$1.$2.aster.tif
mv /tmp/~$1.$2.aster.tif~ /tmp/~$1.$2.aster.tif
gdal_fillnodata.py -md 200 /tmp/~$1.$2.aster.tif
gdalwarp -s_srs EPSG:4326 -t_srs EPSG:900913 -r bilinear /tmp/~$1.$2.aster.tif /tmp/~$1.$2.aster.tif~
unlink /tmp/~$1.$2.aster.tif
mv /tmp/~$1.$2.aster.tif~ /tmp/~$1.$2.aster.tif
gdaldem hillshade -z 3 -alt 66 /tmp/~$1.$2.aster.tif "$DEM_TILE_DIR/~$1.$2.hillshade.tif"
gdal_contour -snodata -32768 -a ele -i 10 /tmp/~$1.$2.aster.tif "$DEM_TILE_DIR/~$1.$2.contours.shp"
fi
#echo $LON_START $LAT_START $LON_END $LAT_END
./get_data_pgis_rect $LON_START $LAT_START $LON_END $LAT_END gis_eu_$1_$2
php stylesheets/general/prepare-db/get-sql-rect.php $LON_START $LAT_START $LON_END $LAT_END $1 $2 | psql -d gis_eu
python /root/map1/relations2lines/relations2lines5.py gis_eu_$1_$2 $LON_START $LAT_START $LON_END $LAT_END
python /root/map1/generate_osmcsymbols.py gis_eu_$1_$2
python /root/map1/generate_highway_access.py gis_eu_$1_$2