Skip to content

Latest commit

 

History

History
177 lines (134 loc) · 5.65 KB

README.md

File metadata and controls

177 lines (134 loc) · 5.65 KB

WPS epandage & zonage

GIS programs

Install and configure PyWPS-3.2.* Instance

PyWPS & GRASS-GIS

Configure the Grass section in the "wps_config.cfg" file :

[grass]
path=/usr/local/grass-version/bin/:/usr/local/grass-version/scripts/:/usr/local/bin/:/usr/bin/
gisbase=/usr/local/grass-version
ldLibraryPath=/usr/local/grass-version/lib/

You may refer to the wps_config.cfg for further customization

Configurate /usr/lib/cgi-bin/pywps.cgi as follow :

#!/bin/sh

# Author: Jachym Cepicky
# Purpose: CGI script for wrapping PyWPS script
# Licence: GNU/GPL
# Usage: Put this script to your web server cgi-bin directory, e.g.
# /usr/lib/cgi-bin/ and make it executable (chmod 755 pywps.cgi)

# NOTE: tested on linux/apache

export PYWPS_CFG=/usr/local/wps/epandage/wps_config.cfg
export PYWPS_PROCESSES=/usr/local/wps/epandage/wps
export HOME=/usr/local/wps/epandage
# Add the right python path of the used version of grass
export PYTHONPATH=/usr/local/grass-7.*/etc/python/

/usr/local/bin/wps.py

For WPS "epandage"

Python 2.7 required modules (2.6 is compatible but deprecated)

- grass.script
- time
- datetime
- os
- tempfile
- hashlib
- yaml
- argparse
- owslib (version >= 0.10)
- geojson
- logging
- multiprocessing
- subprocess
- shlex
- requests

WPS "epandage" usage

Put the epandage folder preferably on the same level of the processes folder (default : /usr/local/pywps/processes ). For exemple in this project is : /usr/local/wps/epandage/wps

Be sure that the PYWPS_PROCESSES variable on "pywps.cgi" contains the the right directory.

Indicate, in the manifest.json, the right path to your configuration file "epandage_process.conf", the others directories (epandage_tmp_dir...).

Here is an example of the configuration file "epandage_process.conf" (containing the WFS URLs and layer names to deal with) :

{
	"RPG_layer": {
		"url": "http://geobretagne.fr.../wfs",
		"name": "RPG",
		"att_name": "ilos_id",
		"login": "",
		"password": ""
	},
	"layerList": {
		"1": {
			"url": "http://geobretagne.fr.../wfs",
			"name": "bdtopo",
			"distance_att": "distanceEau_7",
			"login": "",
			"password": ""
		},
		"2": {
			"url": "http://geobretagne.fr.../wfs",
			"name": "Cadastre",
			"distance_att": "distanceBati",
			"login": "",
			"password": ""
		},
		"3": {
			"url": "http://geobretagne.fr.../wfs",
			"name": "conchylicole",
			"distance_att": "distanceZC",
			"login": "",
			"password": ""
		},
		"4": {
			"...": "..."
		},
		"8": {
			"url": "http://geowww.agrocampus-ouest.fr.../wfs",
			"name": "Vector_SLOPE_layer",
			"distance_att": "slope",
			"login": "",
			"password": ""
		}
	}
}

NB: For the slope layer (number 8 in layerList) to be used in the process, it should containe the value "slope" as 3th value.

The file path (string) should be assigned to the variable named "config_file" on epandage.py

TODO :

  • On epandage.py in the condition, if userData send a "zone epandable plus" (line 642 and 650) the overlay process (line 658 and 685) should dissolve the added polygones with the original polygone (parcelle) to creat one feature instead of two and don't let the polygone (plus) go out of the "parcelle"..

  • Convert the output vector objects to mutiPolygones to remove double objects on the case when the parcelle polygone is sepatated on two or more polygones after the process.

For WPS zonage

This service allows the generation of the slopes zoning vector layer to be used later in the "epandage" WPS service.

Indicate, in the manifest.json, the right directories (zonage_tmp_dir...).

Note: The output layer will automatically be exported on the indicated postgis database.

The default database is "epandage" (on geowww server) and the table is named "zonage_pente_bretagne". This table is published on geoserver with the following referances: URL: http://geowww.agrocampus-ouest.fr/geoserver/epandage/ows name: zonage_pente_bretagne

NB : When the WPS "zoning" is executed, using the default postgis database, it will overwrite the existing table (itself linked to the geoserver layer) and update automatically the native and the declared CRS on geoserver.

Python 2.7 required modules (2.6 is compatible but deprecated)

- os
- time
- datetime
- shutil
- logging
- requests

Powred by AGROCAMPUS-OUEST

Creative Commons License