-
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.
- Loading branch information
Showing
4 changed files
with
134 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# API | ||
|
||
The provided API functionality is currently limited in this package. | ||
Users can | ||
|
||
- list the order information | ||
- list available files in the order | ||
- download a selected file from the order | ||
|
||
## Prerequisites | ||
|
||
### API token | ||
|
||
In order to access the API a token must be generated from | ||
[here](https://apimanager.lantmateriet.se){target="\_blank"} and | ||
set as en environment variable | ||
|
||
```bash | ||
export LANTMATERIET_API_TOKEN=... | ||
``` | ||
|
||
so it can be read from Python as | ||
|
||
```python | ||
import os | ||
|
||
os.environ["LANTMATERIET_API_TOKEN"] | ||
``` | ||
|
||
### Order id | ||
|
||
An order must also be placed through | ||
[geotorget](https://geotorget.lantmateriet.se){target="\_blank"} | ||
and the order id acquired which is a unique id of the form | ||
|
||
```bash | ||
11a2ab333-1234-12ab-12a3-1a2bce3d45ef | ||
``` | ||
|
||
## Usage | ||
|
||
Example usage of the API client | ||
|
||
```python | ||
from lantmateriet.api import Lantmateriet | ||
|
||
client = Lantmateriet("11a2ab333-1234-12ab-12a3-1a2bce3d45ef", "save_path") | ||
|
||
client.order | ||
# show order information | ||
|
||
client.available_files | ||
# show available filed for download in order | ||
|
||
client.download("file.zip") | ||
# download and extract zip file to save_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# CLI | ||
|
||
When you install ifk-lantmateriet a CLI application is also | ||
installed which can be invoked as | ||
|
||
```bash | ||
ifk-lantmateriet --help | ||
``` | ||
|
||
It is mainly provided to simplify automated worekflows, e.g. | ||
to download and extract data periodically. | ||
|
||
## Prerequisites | ||
|
||
In order to use the CLI an API token is necessary, see [API](api.md) page. | ||
|
||
## Usage | ||
|
||
### Download all | ||
|
||
Example of downloading data to a folder called `save_path` | ||
|
||
```bash | ||
ifk-lantmateriet download-all 11a2ab333-1234-12ab-12a3-1a2bce3d45ef save_path | ||
``` | ||
|
||
### Extract all | ||
|
||
Example of extracting located in a folder called `save_path` | ||
|
||
```bash | ||
ifk-lantmateriet extract-all save_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,39 @@ | ||
# Welcome to ifk-lantmateriet | ||
|
||
Docs for ifk-lantmateriet. | ||
ifk-lantmateriet is a python package to work with geo data | ||
from Lantmäteriet (The Swedish Mapping, Cadastral and Land | ||
Registration Authority). The main goal of the package is | ||
to provide reusable components for building maps. | ||
To this end, the package currently provides | ||
|
||
- an API client to fetch subscribed data | ||
- a CLI interface for workflow automation | ||
- vector data manipulation | ||
|
||
## Install | ||
|
||
ifk-lantmateriet can be installed as | ||
|
||
```bash | ||
pip install ifk-lantmateriet | ||
``` | ||
|
||
For the latest build, install from GitHub | ||
|
||
```bash | ||
pip install git+https://github.com/Ingenjorsarbete-For-Klimatet/ifk-lantmateriet.git@main | ||
``` | ||
|
||
## Guide to Lantmäteriet | ||
|
||
Data from Lantmäteriet can be downloaded through | ||
[geotorget](https://geotorget.lantmateriet.se){target="\_blank"}. | ||
Possible orders are | ||
|
||
- single | ||
- subscribed | ||
|
||
Both single and subscribed orders can be downloaded diretly from geotroget, but | ||
only subscribed orders can be downloaded multiple times. Lantmäteriet's API site | ||
can be found [here](https://apimanager.lantmateriet.se){target="\_blank"}. | ||
Accounts are needed for both sites. |
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