-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed several typos in bash scripts.
- Loading branch information
Showing
9 changed files
with
264 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
bin/ | ||
cgi-bin/ | ||
test-bin/ | ||
/bin/ | ||
/cgi-bin/ | ||
/test-bin/ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2008, 2009, 2010, 2011, 2012 Roland Olbricht | ||
# | ||
# This file is part of Overpass_API. | ||
# | ||
# Overpass_API 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 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Overpass_API is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Overpass_API. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
SOURCE_DIR="$1" | ||
LOCAL_DIR="$2" | ||
TARGET_TIME="$3" | ||
LOWER="$4" | ||
UPPER="$5" | ||
TARGET= | ||
|
||
get_replicate_filename() | ||
{ | ||
printf -v TDIGIT3 %03u $(($TARGET % 1000)) | ||
ARG=$(($TARGET / 1000)) | ||
printf -v TDIGIT2 %03u $(($ARG % 1000)) | ||
ARG=$(($ARG / 1000)) | ||
printf -v TDIGIT1 %03u $ARG | ||
LOCAL_PATH="$LOCAL_DIR/$TDIGIT1/$TDIGIT2" | ||
REPLICATE_FILENAME="$LOCAL_PATH/$TDIGIT3" | ||
REMOTE_PATH="$SOURCE_DIR/$TDIGIT1/$TDIGIT2" | ||
REMOTE_FILE="$REMOTE_PATH/$TDIGIT3" | ||
}; | ||
|
||
# $1 - remote source | ||
# $2 - local destination | ||
fetch_file() | ||
{ | ||
wget -nv -O "$2" "$1" | ||
}; | ||
|
||
update_state() | ||
{ | ||
get_replicate_filename | ||
if [[ ! -s "$REPLICATE_FILENAME.state.txt" ]]; then { | ||
mkdir -p "$LOCAL_PATH" | ||
fetch_file "$REMOTE_FILE.state.txt" "$REPLICATE_FILENAME.state.txt" | ||
}; fi | ||
if [[ -s "$REPLICATE_FILENAME.state.txt" ]]; then { | ||
TIMESTAMP_LINE=`grep "^timestamp" <"$REPLICATE_FILENAME.state.txt"` | ||
DATA_VERSION=${TIMESTAMP_LINE:10} | ||
}; fi | ||
}; | ||
|
||
while [[ $(($LOWER + 1)) -lt $UPPER ]]; do | ||
{ | ||
TARGET=$((($LOWER + $UPPER) / 2)) | ||
update_state | ||
#echo "$TARGET - $TIMESTAMP_LINE" | ||
if [[ -s "$REPLICATE_FILENAME.state.txt" && "$DATA_VERSION" < "$TARGET_TIME" ]]; then | ||
{ | ||
LOWER=$TARGET | ||
}; else | ||
{ | ||
UPPER=$TARGET | ||
}; fi | ||
}; done | ||
|
||
echo "$LOWER" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,6 @@ while [[ true ]]; do | |
{ | ||
rm -f "$CLONE_DIR/trigger" | ||
sleep 28800 | ||
} | ||
}; done | ||
|
||
}; done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2008, 2009, 2010, 2011, 2012 Roland Olbricht | ||
# | ||
# This file is part of Overpass_API. | ||
# | ||
# Overpass_API 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 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Overpass_API is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Overpass_API. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
echo "Overpass QL:" | ||
echo "<source lang=cpp>" | ||
echo "$1" | ./osm3s_query --dump-pretty-map-ql --concise | ||
echo "</source>" | ||
echo | ||
echo "XML:" | ||
echo "<source lang=xml>" | ||
echo "$1" | ./osm3s_query --dump-xml --concise | ||
echo "</source>" | ||
echo | ||
echo "Display result: [http://overpass-api.de/api/convert?data=`echo "$1" | ./tocgi`&target=openlayers&zoom=12&lat=50.72&lon=7.1 OpenLayers map] [http://overpass-api.de/api/interpreter?data=%5Bout:json%5D;`echo "$1" | ./tocgi` JSON], [http://overpass-api.de/api/interpreter?data=`echo "$1" | ./tocgi` XML]." |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2008, 2009, 2010, 2011, 2012 Roland Olbricht | ||
# | ||
# This file is part of Overpass_API. | ||
# | ||
# Overpass_API 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 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Overpass_API is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Overpass_API. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
create_query() | ||
{ | ||
echo "<osm-script timeout=\"86400\">" >$5 | ||
|
||
LAT=$1 | ||
while [[ $LAT -lt $2 ]]; do | ||
{ | ||
LON=$3 | ||
while [[ $LON -lt $4 ]]; do | ||
{ | ||
echo "<bbox-query s=\"$LAT\" n=\"$(($LAT+1))\" w=\"$LON\" e=\"$(($LON+1))\"/>" >>$5 | ||
echo "<print mode=\"$6\"/>" >>$5 | ||
echo "<recurse type=\"node-way\" into=\"ways\"/>" >>$5 | ||
echo "<print mode=\"$6\" from=\"ways\"/>" >>$5 | ||
echo "<union>" >>$5 | ||
echo " <recurse type=\"node-relation\"/>" >>$5 | ||
echo " <recurse type=\"way-relation\" from=\"ways\"/>" >>$5 | ||
echo "</union>" >>$5 | ||
echo "<print mode=\"$6\"/>" >>$5 | ||
echo >>$5 | ||
LON=$(($LON + 1)) | ||
}; done | ||
LAT=$(($LAT+1)) | ||
}; done | ||
|
||
echo "</osm-script>" >>$5 | ||
}; | ||
|
||
perform_query() | ||
{ | ||
create_query $1 $2 $3 $4 query_$5.xml $6 | ||
$7/bin/osm3s_query <query_sww.xml | gzip >dump_$5.xml.gz | ||
}; | ||
|
||
perform_query_stripe() | ||
{ | ||
perform_query -90 -30 $1 $2 "s$3" $4 $5 | ||
perform_query -30 30 $1 $2 "m$3" $4 $5 | ||
perform_query 30 90 $1 $2 "n$3" $4 $5 | ||
}; | ||
|
||
perform_global_query() | ||
{ | ||
perform_query_stripe -180 -120 ww $1 $2 | ||
perform_query_stripe -120 -60 wm $1 $2 | ||
perform_query_stripe -60 0 we $1 $2 | ||
perform_query_stripe 0 60 ew $1 $2 | ||
perform_query_stripe 60 120 em $1 $2 | ||
perform_query_stripe 120 180 ee $1 $2 | ||
}; | ||
|
||
perform_global_query $1 $2 |
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