-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CLI to download and extract files
- Loading branch information
Showing
5 changed files
with
113 additions
and
55 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
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,37 @@ | ||
"""CLI module.""" | ||
|
||
import typer | ||
from lantmateriet.api import Lantmateriet | ||
from lantmateriet.extract import extract | ||
from tqdm import tqdm | ||
|
||
app = typer.Typer() | ||
|
||
|
||
@app.callback() | ||
def callback(): | ||
"""Lantmäteriet CLI client.""" | ||
|
||
|
||
@app.command() | ||
def download_all(order_id: str, save_path: str): | ||
"""Download files. | ||
Args: | ||
order_id: lantmäteriet order id | ||
save_path: path to save files to | ||
""" | ||
client = Lantmateriet(order_id, save_path) | ||
all_files = client.available_files | ||
for file in tqdm(all_files): | ||
client.download(file) | ||
|
||
|
||
@app.command() | ||
def extract_all(path: str): | ||
"""Extract geojson from gpkg files. | ||
Args: | ||
path: path to search for files | ||
""" | ||
extract(path) |
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