Commit f48c5f40 authored by Eric Duminil's avatar Eric Duminil
Browse files

Notes

parent 9ae6dab1
...@@ -7,7 +7,7 @@ if the server updates the values. The cache is stored in the file 'bafg_cache.sq ...@@ -7,7 +7,7 @@ if the server updates the values. The cache is stored in the file 'bafg_cache.sq
Usage: Usage:
python .\get_values_from_hag.py --help python get_values_from_hag.py --help
usage: get_values_from_hag.py [-h] [--lat LAT] [--lon LON] [--name NAME] usage: get_values_from_hag.py [-h] [--lat LAT] [--lon LON] [--name NAME]
[--layers LAYERS [LAYERS ...]] [--tree] [--layers LAYERS [LAYERS ...]] [--tree]
...@@ -24,7 +24,7 @@ Usage: ...@@ -24,7 +24,7 @@ Usage:
Show the layers tree: Show the layers tree:
python .\get_values_from_hag.py --tree python get_values_from_hag.py --tree
BfG Hydrologischer Atlas Deutschland BfG Hydrologischer Atlas Deutschland
├── Teil 1: Grundlagen (id = 0) ├── Teil 1: Grundlagen (id = 0)
│ ├── 1.1 Orohydrographie (id = 1) │ ├── 1.1 Orohydrographie (id = 1)
...@@ -139,6 +139,7 @@ def download_tree(url): ...@@ -139,6 +139,7 @@ def download_tree(url):
def get_json(url): def get_json(url):
# TODO: Server somehows requires some time to startup. Ping bafg.de first, and try 3 times at most, with a sleep inbetween?
response = requests.get(url, timeout=TIMEOUT) response = requests.get(url, timeout=TIMEOUT)
text = response.content text = response.content
data = json.loads(text) data = json.loads(text)
...@@ -193,7 +194,8 @@ if __name__ == "__main__": ...@@ -193,7 +194,8 @@ if __name__ == "__main__":
parser.add_argument('--lat', type=float, default=EXAMPLE_LAT, help='Latitude') parser.add_argument('--lat', type=float, default=EXAMPLE_LAT, help='Latitude')
parser.add_argument('--lon', type=float, default=EXAMPLE_LON, help='Longitude') parser.add_argument('--lon', type=float, default=EXAMPLE_LON, help='Longitude')
parser.add_argument('--name', type=str, default=EXAMPLE_LOCATION, help='Location name') parser.add_argument('--name', type=str, default=EXAMPLE_LOCATION, help='Location name')
parser.add_argument('--layers', type=str, nargs='+', default=EXAMPLES_LAYERS, help='Layers to download') parser.add_argument('--layers', type=str, nargs='+',
default=EXAMPLES_LAYERS, help='Layers to download')
parser.add_argument('--tree', action='store_true', help='Display the tree of layers?') parser.add_argument('--tree', action='store_true', help='Display the tree of layers?')
args = parser.parse_args() args = parser.parse_args()
main(args.lat, args.lon, args.name, args.layers, args.tree) main(args.lat, args.lon, args.name, args.layers, args.tree)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment