diff options
author | lookshe <lookshe@lookshe-laptop.(none)> | 2014-09-21 00:39:52 +0200 |
---|---|---|
committer | lookshe <lookshe@lookshe-laptop.(none)> | 2014-09-21 00:39:52 +0200 |
commit | 61672bf575c84e1f3b313fe9ea2dd4de75b601ae (patch) | |
tree | e42d542afd5de8ead38bdc42a002fe0c336b6b75 /osm/main.sh | |
parent | 404e0e28825c805b54d129f8b9d7c5690a27ef17 (diff) | |
parent | 9dd1e786b135cbf333e861f790eb53091904a607 (diff) |
Merge branch 'master' of github.com:lookshe/scripts
Diffstat (limited to 'osm/main.sh')
-rwxr-xr-x | osm/main.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/osm/main.sh b/osm/main.sh new file mode 100755 index 0000000..07e2725 --- /dev/null +++ b/osm/main.sh @@ -0,0 +1,50 @@ +#!/bin/bash +#set -x + +#configuration +config_file=/home/osm/convert/scripts/config.cfg + +# source a specified section from config +function source_section { + section_name="$1" + section_start="^\[$section_name\]$" + section_end="^\[/$section_name\]$" + + line_start=$(grep -n "$section_start" "$config_file" | cut -d: -f1) + line_end=$(expr $(grep -n "$section_end" "$config_file" | cut -d: -f1) - 1) + line_diff=$(expr $line_end - $line_start) + + tmpfile=$(mktemp) + head -n $line_end "$config_file" | tail -n $line_diff > "$tmpfile" + source "$tmpfile" + rm -f "$tmpfile" +} + +# general section from config +source_section "general" + +export osmosis_executable dir_maps dir_output dir_stage dir_poly filetype_osm filetype_map filetype_poly wget_limit_rate + +params_for_xarg_call="" + +#loop over the maps we want to generate +for act_country in $maps_to_generate +do + # reset defaults + wm_type="$default_type" + start_zoom="$default_start_zoom" + language="$default_language" + use_poly="$default_use_poly" + + source_section "$act_country" + + if [ "X$output_subdir" == "X" ] + then + output_subdir="." + fi + + params_for_xarg_call="$params_for_xarg_call \"$download_base_url/$download_map_path/$download_map_file.$filetype_osm\" \"$download_base_url/$download_poly_path/$download_poly_file.$filetype_poly\" \"$act_country.$filetype_map\" \"$wm_type\" \"$start_zoom\" \"$language\" \"$use_poly\" \"$output_subdir\"" +done + +#echo "$params_for_xarg_call" | xargs -n 8 -P $threads_to_start echo +echo "$params_for_xarg_call" | xargs -n 8 -P $threads_to_start $download_and_convert_script |