Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mayer
CircularGreenSimCity
Commits
f48c5f40
Commit
f48c5f40
authored
Jan 25, 2024
by
Eric Duminil
Browse files
Notes
parent
9ae6dab1
Changes
1
Hide whitespace changes
Inline
Side-by-side
python_scripts/get_values_from_hag/get_values_from_hag.py
View file @
f48c5f40
...
...
@@ -7,7 +7,7 @@ if the server updates the values. The cache is stored in the file 'bafg_cache.sq
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]
[--layers LAYERS [LAYERS ...]] [--tree]
...
...
@@ -24,7 +24,7 @@ Usage:
Show the layers tree:
python
.\
get_values_from_hag.py --tree
python get_values_from_hag.py --tree
BfG Hydrologischer Atlas Deutschland
├── Teil 1: Grundlagen (id = 0)
│ ├── 1.1 Orohydrographie (id = 1)
...
...
@@ -139,6 +139,7 @@ def download_tree(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
)
text
=
response
.
content
data
=
json
.
loads
(
text
)
...
...
@@ -193,7 +194,8 @@ if __name__ == "__main__":
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
(
'--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?'
)
args
=
parser
.
parse_args
()
main
(
args
.
lat
,
args
.
lon
,
args
.
name
,
args
.
layers
,
args
.
tree
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment