This project provides an import tool between GeoNature instances (client side). Widely inspired from ClientApiVN
Topics
Warning
Actually in development.
GN2PG Client can be installed by running pip
. It requires Python 3.7.4# to run.
pip install gn2pg-client
Please report any bugs or requests that you have using the GitHub issue tracker!
gn2pg_cli --help
This command init a TOML config file within ~/.gn2pg
hidden directory (in user HOME
directory), named as you want. PLEASE DO NOT SPECIFY PATH!
gn2pg_cli --init <myconfigfile>
Config file is structured as this. [[source]]
block can be duplicate as many as needed (one block for each source).
# GN2PG configuration file
# Local db configuration
[db]
db_host = "localhost"
db_port = 5432
db_user = "<dbUser>"
db_password = "<dbPassword>"
db_name = "<dbName>"
db_schema_import = "schema"
# Additional connection options (optional)
[db.db_querystring]
sslmode = "prefer"
# Source configuration,
# Ducplicate this block for each source (1 source = 1 export)
[[source]]
# Source name, will be use to tag stored data in import table
name = "Source1"
# GeoNature source login
user_name = "<monuser>"
# GeoNature source password
user_password = "<monPwd>"
# GeoNature source URL
url = "<http://geonature1/>"
# GeoNature source Export id
export_id = 1
[[source]]
# Source configuration
name = "Source2"
user_name = "<monuser>"
user_password = "<monPwd>"
url = "<http://geonature2/>"
export_id = 1
Tip
You can add variable in source block enable = false
to disable a source
To create json tables where datas will be downloaded, run :
gn2pg_cli --json-tables-create <myconfigfile>
To full download json datas into synthese_json table, run :
gn2pg_cli --full <myconfigfile>
Warning
[WIP] Not yet implemented!
Log files are stored in $HOME/.gn2pg/log
directory.
Default script to auto populate GeoNature is called "to_gnsynthese".
gn2pg_cli --custom-script to_gnsynthese <myconfigfile>
Tip
You can also replacing synthese script by your own scripts, using file path instead of to_gnsynthese
.
All devs must be done in forks.
Pull requests must be pulled to dev branch. For example with this command:
gh repo fork --clone lpoaura/gn2pg_client
Install project and development requirements (require poetry):
poetry install
Make your devs and pull requests.
Run gn2pg_cli command in dev mode
poetry run gn2pg_cli <options>
poetry export -f requirements.txt > requirements.txt
- @lpofredc (LPO Auvergne-Rhône-Alpes), main developper
With the financial support of the DREAL Auvergne-Rhône-Alpes.