Skip to content

Latest commit

 

History

History
76 lines (58 loc) · 2.14 KB

README.md

File metadata and controls

76 lines (58 loc) · 2.14 KB

About

This repository hosts a work initiated by GéoBretagne. The provided vrt.sh script aims at consuming some GDAL Virtual formats (VRT) files and load the underlying datas into a dedicated PostGIS database.

Example

See the vrts/sample.vrt file for an example:

<?xml version="1.0"?>
<OGRVRTDataSource>
  <OGRVRTLayer name="pr_n_projetsindustriels">
    <SrcDataSource>https://www.data.gouv.fr/fr/datasets/r/b5536fc9-eb1c-421f-bf73-fedad9508409</SrcDataSource>
    <SrcLayer>b5536fc9-eb1c-421f-bf73-fedad9508409</SrcLayer>
    <SrcSQL>SELECT * FROM "b5536fc9-eb1c-421f-bf73-fedad9508409"</SrcSQL>
    <Field name="nom_entreprise" src="entreprise" type="String"/>
    <Field name="type_entreprise" src="type_entreprise" type="String"/>
    <Field name="siren_entreprise" src="siren" type="String"/>
  </OGRVRTLayer>
</OGRVRTDataSource>

Configuration via environment variables

The following environment variables are expected:

# export PGHOST="127.0.0.1"
# export PGPORT="5432"
# export PGUSER="georchestra"
# export PGDATABASE="georchestra"
# export PGCLIENTENCODING="utf8"
# export PGPASSWORD="georchestra"

# export ACTIVESCHEMA="public"
# export SOURCEDIR=vrts

The vrt.sh script is meant to be called regularly via a Cronjob (every 5 hours or more, as the datasets will be downloaded and published again at each run), with the previous variables defined.

Optional variables

The following environment variables are optional:

/**
* PROMOTE_TO_MULTI can be used to automatically promote layers that mix polygon or multipolygons to multipolygons, 
* and layers that mix linestrings or multilinestrings to multilinestrings. 
* Can be useful when converting shapefiles to PostGIS 
* and other target drivers that implement strict checks for geometry types
*
* Enabled by default
**/
# export PROMOTE_TO_MULTI=false 

Docker

The provided Dockerfile is meant to build the vrt-bot image, and a build can be triggered via docker-compose:

$ docker-compose build

A volume is declared, where the vrt files can be uploaded:

    volumes:
    - ./path/to/your/vrts:/home/app/vrts