This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 95
/
get-coastlines.sh
executable file
·82 lines (65 loc) · 2.46 KB
/
get-coastlines.sh
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
74
75
76
77
78
79
80
81
82
#!/bin/sh
# Copyright (C) 2010 Rodolphe Quiédeville <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
UNZIP=/usr/bin/unzip
TAR=/bin/tar
BUNZIP2=/bin/bunzip2
WGET=/usr/bin/wget
if [ -z $1 ] ; then
OUTDIR=`pwd`
else
OUTDIR=$1
fi
if [ ! -x $UNZIP ]; then
echo "unzip is not installed in $UNZIP, it is needed by this script"
exit
fi
if [ ! -x $TAR ]; then
echo "tar is not installed in $TAR, it is needed by this script"
exit
fi
if [ ! -x $BUNZIP2 ]; then
echo "bunzip2 is not installed in $BUNZIP2, it is needed by this script"
exit
fi
if [ ! -x $WGET ]; then
echo "wget is not installed in $WGET, it is needed by this script"
exit
fi
if [ ! -e $OUTDIR ]; then
mkdir $OUTDIR
fi
$WGET http://tile.openstreetmap.org/world_boundaries-spherical.tgz -O $OUTDIR/world_boundaries-spherical.tgz
$WGET http://tile.openstreetmap.org/processed_p.tar.bz2 -O $OUTDIR/processed_p.tar.bz2
$WGET http://tile.openstreetmap.org/shoreline_300.tar.bz2 -O $OUTDIR/shoreline_300.tar.bz2
$WGET http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_populated_places.zip -O $OUTDIR/ne_10m_populated_places.zip
$WGET http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_boundary_lines_land.zip -O $OUTDIR/ne_110m_admin_0_boundary_lines_land.zip
$TAR xvf $OUTDIR/world_boundaries-spherical.tgz -C $OUTDIR
if [ -d $OUTDIR/world_boundaries ]; then
if [ -f $OUTDIR/processed_p.tar.bz2 ]; then
$TAR xvf $OUTDIR/processed_p.tar.bz2 -C $OUTDIR
mv $OUTDIR/processed_p.[dis]* $OUTDIR/world_boundaries/
else
echo 'processed_p.tar.bz2 not present'
fi
if [ -f $OUTDIR/shoreline_300.tar.bz2 ]; then
$TAR xvf $OUTDIR/shoreline_300.tar.bz2 -C $OUTDIR
mv $OUTDIR/shoreline_300.[dis]* $OUTDIR/world_boundaries/
else
echo 'shoreline_300.tar.bz2 not present'
fi
if [ -f $OUTDIR/ne_10m_populated_places.zip ]; then
$UNZIP -o $OUTDIR/ne_10m_populated_places.zip -d $OUTDIR/world_boundaries
else
echo 'ne_10m_populated_places.zip not present'
fi
if [ -f $OUTDIR/ne_110m_admin_0_boundary_lines_land.zip ]; then
$UNZIP -o $OUTDIR/ne_110m_admin_0_boundary_lines_land.zip -d $OUTDIR/world_boundaries
else
echo 'ne_110m_admin_0_boundary_lines_land.zip not present'
fi
fi