forked from CEN-RA/Plugin_QGIS
Téléverser les fichiers vers "CenRa_FLUX"
This commit is contained in:
parent
543e94c861
commit
cbccca397b
60
CenRa_FLUX/README.md
Normal file
60
CenRa_FLUX/README.md
Normal file
@ -0,0 +1,60 @@
|
||||
# <p align="center">FluxCEN</p>
|
||||
|
||||
<img align="left" src=https://raw.githubusercontent.com/CEN-Nouvelle-Aquitaine/fluxcen/main/icon.png width="220"/>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
Le plugin QGIS FluxCEN permet d'accéder rapidement à un large éventail de flux WFS/WMS organisés par catégories et interrogeables sous forme de mots-clés.
|
||||
<br>
|
||||
<br>
|
||||
Il évite ainsi d'avoir à gérer dans QGIS une multitude de connexions.
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## 🧐 Features
|
||||
- Sélection rapide des ressources par autocomplétion
|
||||
- Regroupement des flux au sein de catégories
|
||||
- Gestion des styles par défaut à l'ouverture dans QGIS pour les données WFS
|
||||
- Centralisation et gestion des flux simplifiée dans un fichier .csv
|
||||
- Code et ressources attachées gérées directement via le git
|
||||
- Prise en charge des flux Geoserver et Mapserver
|
||||
- Lien direct vers la fiche de métadonnées de la ressource
|
||||
|
||||
## Composition du fichier .csv
|
||||
|
||||
* service : type de service utilisé (WFS ou WMS)
|
||||
* categorie : categorie de la couche pour affichage et recherche dans le plugin
|
||||
* Nom_couche_plugin : nom de la couche qui s'affichera dans le plugin
|
||||
* nom_technique : nom technique de la couche utilisé sur le serveur source (caché dans le plugin)
|
||||
* url : URL du serveur pour accéder à la couche
|
||||
* source : Source de la donnée
|
||||
* style : nom du fichier de style pour affichage à l'ouverture dans QGIS
|
||||
* metadonnees : URL d'accès à la fiche de métadonnées liée à la resource
|
||||
|
||||
Exemple pour accéder à la BD ORTHO® :
|
||||
|
||||
| service | categorie | Nom_couche_plugin | nom_technique | url | source | style |
|
||||
| -------- | -------- | -------- | -------- | -------- |-------- | -------- |
|
||||
| WMS Raster| Fonds cartos | BD ORTHO® | HR.ORTHOIMAGERY.ORTHOPHOTOS |https://wxs.ign.fr/ortho/geoportail/r/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities| IGN | |
|
||||
|
||||
|
||||
|
||||
## Style des couches
|
||||
|
||||
Le dossier *styles_couches* stocke les styles QGIS au format .qml afin d'appliquer par défaut ce style à l'ouverture de la couche dans QGIS. L'ajout d'un style dans ce dossier nécessite de reporter le nom du fichier .qml dans le champ "style" du csv.
|
||||
|
||||
|
||||
## Accès aux données protégées
|
||||
|
||||
Si l'accès à la majorité des ressources reste public, certaines peuvent être protégées par un mot de passe (données métier confidentielles par exemple).
|
||||
|
||||
Cette authentification est gérée via le serveur cartographique qui génère les flux.
|
||||
Pour y accéder, il faut créer en amont une authentification dans QGIS. L'ouverture des données protégées se fera alors à partir de la première authentification enregistrée dans QGIS (pas de gestion multi-authentification pour le moment)
|
||||
|
||||
## Interface du plugin:
|
||||
|
||||
<img align="center" src=https://raw.githubusercontent.com/CEN-Nouvelle-Aquitaine/fluxcen/main/fluxcen_interface.PNG width="600"/>
|
||||
|
||||
|
||||
|
||||
BIN
CenRa_FLUX/logo.png
Normal file
BIN
CenRa_FLUX/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
111
CenRa_FLUX/plugin_upload.py
Normal file
111
CenRa_FLUX/plugin_upload.py
Normal file
@ -0,0 +1,111 @@
|
||||
#!/usr/bin/env python
|
||||
# coding=utf-8
|
||||
"""This script uploads a plugin package to the plugin repository.
|
||||
Authors: A. Pasotti, V. Picavet
|
||||
git sha : $TemplateVCSFormat
|
||||
"""
|
||||
|
||||
import sys
|
||||
import getpass
|
||||
import xmlrpc.client
|
||||
from optparse import OptionParser
|
||||
|
||||
standard_library.install_aliases()
|
||||
|
||||
# Configuration
|
||||
PROTOCOL = 'https'
|
||||
SERVER = 'plugins.qgis.org'
|
||||
PORT = '443'
|
||||
ENDPOINT = '/plugins/RPC2/'
|
||||
VERBOSE = False
|
||||
|
||||
|
||||
def main(parameters, arguments):
|
||||
"""Main entry point.
|
||||
|
||||
:param parameters: Command line parameters.
|
||||
:param arguments: Command line arguments.
|
||||
"""
|
||||
address = "{protocol}://{username}:{password}@{server}:{port}{endpoint}".format(
|
||||
protocol=PROTOCOL,
|
||||
username=parameters.username,
|
||||
password=parameters.password,
|
||||
server=parameters.server,
|
||||
port=parameters.port,
|
||||
endpoint=ENDPOINT)
|
||||
print("Connecting to: %s" % hide_password(address))
|
||||
|
||||
server = xmlrpc.client.ServerProxy(address, verbose=VERBOSE)
|
||||
|
||||
try:
|
||||
with open(arguments[0], 'rb') as handle:
|
||||
plugin_id, version_id = server.plugin.upload(
|
||||
xmlrpc.client.Binary(handle.read()))
|
||||
print("Plugin ID: %s" % plugin_id)
|
||||
print("Version ID: %s" % version_id)
|
||||
except xmlrpc.client.ProtocolError as err:
|
||||
print("A protocol error occurred")
|
||||
print("URL: %s" % hide_password(err.url, 0))
|
||||
print("HTTP/HTTPS headers: %s" % err.headers)
|
||||
print("Error code: %d" % err.errcode)
|
||||
print("Error message: %s" % err.errmsg)
|
||||
except xmlrpc.client.Fault as err:
|
||||
print("A fault occurred")
|
||||
print("Fault code: %d" % err.faultCode)
|
||||
print("Fault string: %s" % err.faultString)
|
||||
|
||||
|
||||
def hide_password(url, start=6):
|
||||
"""Returns the http url with password part replaced with '*'.
|
||||
|
||||
:param url: URL to upload the plugin to.
|
||||
:type url: str
|
||||
|
||||
:param start: Position of start of password.
|
||||
:type start: int
|
||||
"""
|
||||
start_position = url.find(':', start) + 1
|
||||
end_position = url.find('@')
|
||||
return "%s%s%s" % (
|
||||
url[:start_position],
|
||||
'*' * (end_position - start_position),
|
||||
url[end_position:])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = OptionParser(usage="%prog [options] plugin.zip")
|
||||
parser.add_option(
|
||||
"-w", "--password", dest="password",
|
||||
help="Password for plugin site", metavar="******")
|
||||
parser.add_option(
|
||||
"-u", "--username", dest="username",
|
||||
help="Username of plugin site", metavar="user")
|
||||
parser.add_option(
|
||||
"-p", "--port", dest="port",
|
||||
help="Server port to connect to", metavar="80")
|
||||
parser.add_option(
|
||||
"-s", "--server", dest="server",
|
||||
help="Specify server name", metavar="plugins.qgis.org")
|
||||
options, args = parser.parse_args()
|
||||
if len(args) != 1:
|
||||
print("Please specify zip file.\n")
|
||||
parser.print_help()
|
||||
sys.exit(1)
|
||||
if not options.server:
|
||||
options.server = SERVER
|
||||
if not options.port:
|
||||
options.port = PORT
|
||||
if not options.username:
|
||||
# interactive mode
|
||||
username = getpass.getuser()
|
||||
print("Please enter user name [%s] :" % username, end=' ')
|
||||
|
||||
res = input()
|
||||
if res != "":
|
||||
options.username = res
|
||||
else:
|
||||
options.username = username
|
||||
if not options.password:
|
||||
# interactive mode
|
||||
options.password = getpass.getpass()
|
||||
main(options, args)
|
||||
5194
CenRa_FLUX/resources.py
Normal file
5194
CenRa_FLUX/resources.py
Normal file
File diff suppressed because it is too large
Load Diff
8
CenRa_FLUX/resources.qrc
Normal file
8
CenRa_FLUX/resources.qrc
Normal file
@ -0,0 +1,8 @@
|
||||
<RCC>
|
||||
<qresource prefix="/plugins/CenRa_FLUX" >
|
||||
<file>reficon.png</file>
|
||||
<file>arrow-up.png</file>
|
||||
<file>arrow-bottom.png</file>
|
||||
<file>logo.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
Loading…
x
Reference in New Issue
Block a user