biommap/utils/README.md
2021-09-13 16:38:41 +02:00

1.6 KiB

utils

This folder contains some scripts for preparing some data for the municipality of Wasseiges.

Init

The scripts are python scripts that should run into a virtual environment.

First, install the local dependencies:

$ pip3 install -r requirements.txt
$ source bin/activate

Import of the layer Arbres remarquables

(venv) python3 geojson2sql.py

Some notes about this import

The import script creates database entries by filling not all the field of the table. Only mandatory (non-nullable) fields and informative fields are filled.

Here is the column list and the corresponding values list:

    column_list = ['uuid_sinp', 'id_program', 'name', 'geom', 'timestamp_create', 'id_type', 'obs_txt']
    values_list = ['UUID', '2', 'import arbres remarquables', 'POINT', 'NOW', '1', 'import' ]

Some values in these list MUST follow some conventions:

  • the "UUID" value will be converted to a a formula that creates uuid value
  • the "POINT" value will be converted to a PostGIS ST_GeomFromText formula based on the coordinates of the geojson file
  • the "NOW" value will be converted to a formula that creates a timestamp

Lastly, if the values starts with properties., it will be mapped to a property in the geojson. E.g, properties.COMMENTAIR.