Skip to content

Commit

Permalink
Create new section for importing data and reorganize doc
Browse files Browse the repository at this point in the history
  • Loading branch information
bruhnild committed Dec 18, 2024
1 parent 3096ed7 commit 70fb50b
Show file tree
Hide file tree
Showing 15 changed files with 916 additions and 834 deletions.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"media": "(prefers-color-scheme: light)",
"scheme": "default",
"primary": "red",
"accent": "deep-orange",
"accent": "pink",
"toggle": {
"icon": "material/weather-night",
"name": "Switch to dark mode",
Expand All @@ -71,7 +71,7 @@
"media": "(prefers-color-scheme: dark)",
"scheme": "slate",
"primary": "red",
"accent": "deep-orange",
"accent": "pink",
"toggle": {
"icon": "material/weather-sunny",
"name": "Switch to light mode",
Expand Down
14 changes: 12 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,22 @@ Geotrek-admin is backend management data for Geotrek-rando, Geotrek-mobile and G

install/installation
install/upgrade
install/loading-data
install/configuration
install/advanced-configuration
install/maintenance
install/exploitation-commands
install/synchronization
install/import

.. toctree::
:caption: 🗃️ Import data
:maxdepth: 2

install/prerequisites-data
install/load-mnt-raster
install/import-paths
install/import-other-data-from-file
install/import-from-network
install/import-from-touristic-data-systems

.. toctree::
:caption: ✨ Contribute
Expand Down
36 changes: 21 additions & 15 deletions docs/install/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ Configuration
:local:
:depth: 2

.. _basic-configuration-update:

Basic configuration update
--------------------------
===========================

To update basic configuration (server name, database connection, languages, or set workers number or timeout), run:

Expand All @@ -19,9 +20,10 @@ To update basic configuration (server name, database connection, languages, or s
The basic configuration is stored in ``/opt/geotrek-admin/var/conf/env`` file, not to be changed manually.
This file also contains the PostgreSQL authentification details, if you need to access your Geotrek-admin database.

.. _custom-setting-file:

Custom setting file
-------------------
====================

Geotrek-admin advanced configuration is done in ``/opt/geotrek-admin/var/conf/custom.py`` file.

Expand All @@ -44,6 +46,7 @@ Sometimes you also have to run:

Don't override the ``os.getenv()`` settings as they are managed with Basic configuration.

.. _nginx-configuration:

NGINX configuration
-------------------
Expand All @@ -56,9 +59,10 @@ Modify ``/opt/geotrek-admin/var/conf/nginx.conf.in`` instead. To update ``nginx.
sudo dpkg-reconfigure geotrek-admin
.. _activate-ssl-https:

Activate SSL / HTTPS
--------------------
=====================

To activate https, you need firstly to change ``custom.py`` and add:

Expand All @@ -79,12 +83,13 @@ You have to move the configuration to the file ``nginx.conf.in`` because ``nginx

You need to replace the ``$`` from Certbot with ``${DOLLAR}`` everywhere in the ``nginx.conf.in`` file, then run the command ``sudo dpkg-reconfigure geotrek-admin`` to regenerate the file.

.. _mandatory-settings:

Mandatory settings
------------------
==================

Spatial reference identifier
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----------------------------

.. code-block:: python
Expand All @@ -99,7 +104,7 @@ Spatial reference identifier of your database. Default 2154 is RGF93 / Lambert-9
.. _default-structure:

Default Structure
~~~~~~~~~~~~~~~~~
----------------------------

.. code-block:: python
Expand All @@ -114,9 +119,8 @@ Name for your default structure.
* *Change in the settings*
* *Re-run the server.*


Dynamic segmentation
~~~~~~~~~~~~~~~~~~~~
----------------------

.. code-block:: python
Expand All @@ -134,9 +138,8 @@ So if you want to use Geotrek-admin without dynamic segmentation, set TREKKING_T

Do not change it again to true after setting it to false.


Translations
~~~~~~~~~~~~
-------------

.. code-block:: python
Expand All @@ -152,9 +155,11 @@ Languages of your project. It will be used to generate fields for translations.

*You won't be able to change it easily, avoid to add any languages and do not remove any.*

.. note::
It is preferable, when in doubt, to include all necessary languages during the initial installation, even if some remain unused afterward, rather than missing some and facing complications to add them later.

Spatial extents
~~~~~~~~~~~~~~~
----------------

Boundingbox of your project : x minimum , y minimum , x max, y max::

Expand All @@ -180,15 +185,17 @@ is available at ``http://<server_url>/tools/extents/``.

Administrator privileges are required.

.. _users-management:

Users management
----------------
==================

See :ref:`user management section in usage <user-management-section>`.

.. _database-users:

Database users
--------------
===============

It is not safe to use the ``geotrek`` user in QGIS, or to give its password to
many collaborators.
Expand All @@ -199,7 +206,6 @@ With *pgAdmin*, you can create database users like this:

::


CREATE ROLE lecteur LOGIN;
ALTER USER lecteur PASSWORD 'passfacile';
GRANT CONNECT ON DATABASE geotrekdb TO lecteur;
Expand All @@ -213,6 +219,6 @@ And give them permissions by schema :
GRANT SELECT ON ALL TABLES IN SCHEMA public TO lecteur;
GRANT SELECT ON ALL TABLES IN SCHEMA geotrek TO lecteur;

You can also create groups, etc. See `PostgreSQL documentation <https://www.postgresql.org/docs/>`_.

You can also create groups, etc. See PostgreSQL documentation.

157 changes: 157 additions & 0 deletions docs/install/exploitation-commands.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
======================
Exploitation commands
======================

.. contents::
:local:
:depth: 2

.. _delete-attachement-from-disk:

Delete attachment from disk
============================

When an attachment (eg. pictures) is removed, its file is not automatically removed from disk.
You have to run ``sudo geotrek clean_attachments`` manually or in a cron to remove old files.
After that, you should run ``sudo geotrek thumbnail_cleanup`` to remove old thumbnails.

.. _remove-duplicate-paths:

Remove duplicate paths
======================

Duplicate paths can appear while adding paths with commands or directly in the application.
Duplicate paths can cause some problems of routing for topologies, it can generate corrupted topologies (that become MultiLineStrings instead of LineStrings).

You have to run ``sudo geotrek remove_duplicate_paths``

During the process of the command, every topology on a duplicate path will be set on the original path, and the duplicate path will be deleted.

.. _merge-segmented-paths:

Merge segmented paths
=====================

A path network is most optimized when there is only one path between intersections.
If the path database includes many fragmented paths, they could be merged to improve performances.

You can run ``sudo geotrek merge_segmented_paths``.

.. danger::
This command can take several hours to run. During the process, every topology on a path will be set on the path it is merged with, but it would still be more efficient (and safer) to run it before creating topologies.

Before :
::

p1 p2 p3 p5 p6 p7 p8 p9 p14
+-------+------+-------+------+-------+------+-------+------+------+
| |
| p4 | p13
| |
+ +-------
| | |
| p10 | p16 |
p11 | | |
+------+------+ p15 --------
|
| p12
|

After :
::

p1 p6 p14
+--------------+-----------------------------+---------------------+
| |
| | p13
| |
| p10 +-------
| | |
| | p16 |
p11 | | |
+------+------+ p15 --------
|
| p12
|

.. _unset-structure-on-categories:

Unset structure on categories
=============================

Use this command if you wish to undo linking categories to structures for some models.

You have to run ``sudo geotrek unset_structure``

::

usage: manage.py unset_structure [-h] [--all] [--list] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] [--force-color]
[--skip-checks]
[model [model ...]]

Unset structure in lists of choices and group choices with the same name.

positional arguments:
model List of choices to manage

optional arguments:
-h, --help show this help message and exit
--all Manage all models
--list Show available models to manage
--version show program's version number and exit
-v {0,1,2,3}, --verbosity {0,1,2,3}
Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output
--settings SETTINGS The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
--pythonpath PYTHONPATH
A directory to add to the Python path, e.g. "/home/djangoprojects/myproject".
--traceback Raise on CommandError exceptions
--no-color Don't colorize the command output.
--force-color Force colorization of the command output.
--skip-checks Skip system checks.

.. danger::
You can't chose for each choice which set of category you want to unset structures, it will happen for all categories

Firstly, if a categroy is linked to a structure, it creates the same category but with no structure associated.
Secondly, every element with this old category gets assigned to this new category.
Finally all old categories are removed.

.. _reorder-topologies:

Reorder topologies
===================

All topologies have information about which path they go through on and in which order.
Actually, when a path is split in 2 by another path, a new path is added to the database.
We need to add information for all topologies that need to go through this new path.
This is badly managed at the moment, especially for the order of passage of the paths.
``sudo geotrek reorder_topologies``

It removes a lot of useless information which can accelerate the process of editing topologies afterward.

During the process of this command, it tries to find a good order of passage on the paths which creates
only one Linestring from start to end. It stays as close as possible to the corrupted order. This command uses the same algorithm to generate one Linestring
when the order is not well managed during topologies' display.

.. danger::
It can happen that this algorithm can't find any solution and will genereate a MultiLineString.
This will be displayed at the end of the reorder

.. _automatic-commands:

Automatic commands
==================

You can set up automatic commands by creating a `cron` file under ``/etc/cron.d/geotrek_command`` that contains:

::

0 3 * * * root /usr/sbin/geotrek <command> <options>

example :

::

0 4 * * * root /usr/sbin/geotrek reorder_topologies

This example will automatically reorder topologies at 4 am every day.
Loading

0 comments on commit 70fb50b

Please sign in to comment.