2021-02-10 12:02:44 +00:00
|
|
|
<p align="center">
|
|
|
|
<img src="./.github/logo.svg" width="500px" alt="NeoFS">
|
|
|
|
</p>
|
|
|
|
<p align="center">
|
2022-12-22 13:28:24 +00:00
|
|
|
UN/LOCODE database for <a href="https://frostfs.info">ForstFS</a>
|
2021-02-10 12:02:44 +00:00
|
|
|
</p>
|
|
|
|
|
|
|
|
---
|
2022-12-22 13:28:24 +00:00
|
|
|
![GitHub release](https://img.shields.io/github/release/TrueCloudLab/frostfs-locode-db.svg)
|
|
|
|
![GitHub license](https://img.shields.io/github/license/TrueCloudLab/frostfs-locode-db.svg?style=popout)
|
2021-02-10 12:02:44 +00:00
|
|
|
|
|
|
|
# Overview
|
|
|
|
|
2022-12-22 13:28:24 +00:00
|
|
|
This repository contains instructions to generate UN/LOCODE database for FrostFS
|
|
|
|
and raw representation of it. FrostFS uses UN/LOCODE in storage node attributes
|
2022-10-27 12:05:52 +00:00
|
|
|
and storage policies. Inner ring nodes converts UN/LOCODE into human-readable
|
2022-12-22 13:28:24 +00:00
|
|
|
set of attributes such as continent, country name, etc.
|
2021-02-10 12:02:44 +00:00
|
|
|
|
|
|
|
# Build
|
|
|
|
|
|
|
|
## Prerequisites
|
|
|
|
|
2022-12-22 13:28:24 +00:00
|
|
|
- Latest [frost] tool(https://github.com/TrueCloudLab/frostfs-node)
|
2022-10-27 12:05:52 +00:00
|
|
|
- [UN/LOCODE](https://unece.org/trade/cefact/UNLOCODE-Download)
|
2021-02-10 12:02:44 +00:00
|
|
|
database in CSV format
|
|
|
|
- [OpenFlight Airports](https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat)
|
|
|
|
database
|
|
|
|
- [OpenFlight Countries](https://raw.githubusercontent.com/jpatokal/openflights/master/data/countries.dat)
|
|
|
|
database
|
|
|
|
|
2022-10-27 10:45:25 +00:00
|
|
|
## Quick start
|
|
|
|
|
2022-12-22 13:28:24 +00:00
|
|
|
Just run `make` to generate `locode_db` file for use with FrostFS InnerRing nodes.
|
2022-10-27 10:45:25 +00:00
|
|
|
|
|
|
|
``` shell
|
|
|
|
$ make
|
|
|
|
...
|
|
|
|
--out locode_db
|
|
|
|
```
|
|
|
|
|
|
|
|
## Building
|
2021-02-10 12:02:44 +00:00
|
|
|
|
|
|
|
First unzip file with GeoJSON continents from this repository.
|
|
|
|
```
|
|
|
|
$ gunzip continents.geojson
|
|
|
|
```
|
|
|
|
|
2022-12-22 13:28:24 +00:00
|
|
|
Then run frost command to generate boltDB file.
|
2021-02-10 12:02:44 +00:00
|
|
|
```
|
2022-12-22 13:28:24 +00:00
|
|
|
$ frost util locode generate --help
|
|
|
|
generate UN/LOCODE database for FrostFS
|
2021-02-10 12:02:44 +00:00
|
|
|
|
|
|
|
Usage:
|
2022-12-22 13:28:24 +00:00
|
|
|
frost util locode generate [flags]
|
2021-02-10 12:02:44 +00:00
|
|
|
|
|
|
|
Flags:
|
|
|
|
--airports string Path to OpenFlights airport database (csv)
|
|
|
|
--continents string Path to continent polygons (GeoJSON)
|
|
|
|
--countries string Path to OpenFlights country database (csv)
|
|
|
|
-h, --help help for generate
|
|
|
|
--in strings List of paths to UN/LOCODE tables (csv)
|
|
|
|
--out string Target path for generated database
|
|
|
|
--subdiv string Path to UN/LOCODE subdivision database (csv)
|
2022-10-27 12:05:52 +00:00
|
|
|
|
2022-12-22 13:28:24 +00:00
|
|
|
$ ./frost util locode generate \
|
2021-02-10 12:02:44 +00:00
|
|
|
--airports airports.dat \
|
|
|
|
--continents continents.geojson \
|
|
|
|
--countries countries.dat \
|
2022-10-27 12:05:52 +00:00
|
|
|
--in 2022-1\ UNLOCODE\ CodeListPart1.csv,2022-1\ UNLOCODE\ CodeListPart2.csv,2022-1\ UNLOCODE\CodeListPart3.csv \
|
2021-02-10 12:02:44 +00:00
|
|
|
--subdiv 2020-2\ SubdivisionCodes.csv \
|
|
|
|
--out locode_db
|
|
|
|
```
|
|
|
|
|
|
|
|
**Database generation might take some time!**
|
|
|
|
|
2022-12-22 13:28:24 +00:00
|
|
|
You can test generated database with `frost`.
|
2021-02-10 12:02:44 +00:00
|
|
|
```
|
2022-12-22 13:28:24 +00:00
|
|
|
$ frost util locode info --db locode_db --locode 'RU LED'
|
2021-02-10 12:02:44 +00:00
|
|
|
Country: Russia
|
|
|
|
Location: Saint Petersburg (ex Leningrad)
|
|
|
|
Continent: Europe
|
|
|
|
Subdivision: [SPE] Sankt-Peterburg
|
2022-10-27 12:05:52 +00:00
|
|
|
Coordinates: 59.88, 30.25
|
|
|
|
```
|
|
|
|
|
|
|
|
# Building Debian package
|
|
|
|
|
|
|
|
The most simple way is to run a make target
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ make debpackage
|
|
|
|
```
|
|
|
|
|
|
|
|
When packages are built, you can clean up the leftover with
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ dh clean
|
|
|
|
```
|
|
|
|
or
|
|
|
|
```shell
|
|
|
|
$ make debclean
|
2021-02-10 12:02:44 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
This project is licensed under the CC Attribution-ShareAlike 4.0 International -
|
|
|
|
see the [LICENSE](LICENSE) file for details
|