Lizmap plugin for QGIS, allowing to publish QGIS maps to Lizmap Web Client
Clone or download
mdouchin Merge pull request #118 from sylsta/master
Enable popup configuration of a project layer (Layers panel)
Latest commit 23838ae Sep 4, 2018

README.md

logoLizmap 3.0.0

WARNING the master branch is compatible only with QGIS 3.x from August 23rd 2018. The branch qgis2 targets QGIS 2.x compatibiliy.

Publication plugin for Lizmap Web Application, by 3LIZ.

begin       : 2011-11-01
copyright   : (C) 2011 by 3liz
authors     : René-Luc D'Hont and Michaël Douchin
email       : info@3liz.com
website     : http://www.3liz.com

Lizmap Qgis plugin aims to be used to configure a web application dynamically generated by Lizmap (php/html/css/js) with the help of Qgis Server ( QGIS Server Tutorial ) With this plugin, you can configure one web map per Qgis project. The Lizmap web application must be installed on the server.

The Original Code is 3liz code.

Authors

The Initial Developer of the Original Code are René-Luc D'Hont rldhont@3liz.com and Michael Douchin mdouchin@3liz.com. Portions created by the Initial Developer are Copyright (C) 2011 the Initial Developer. All Rights Reserved.

Contributors

  • Salvatore Larosa @slarosa
  • Paolo Cavallini @pcav
  • Arnaud Deleurme
  • @ewsterrenburg
  • Sławomir Bienias @SaekBinko
  • Petr Tsymbarovich @mentaljam
  • Víctor Herreros @vherreros
  • João Gaspar
  • Felix Kuehne
  • Kari Salovaara
  • Xan Vieiro
  • Etienne Trimaille @Gustry
  • José Macau

Please propose a PR to add yourself if you are missing

Installation

from github repository:

  1. Clone the repo: git clone git@github.com:3liz/lizmap-plugin.git
  2. cp lizmap-plugin ~/.qgis2/python/plugins
  3. cd ~/.qgis2/python/plugins
  4. mv lizmap-plugin lizmap

or from QGIS application:

  1. Plugins menu -> Manage and Install Plugins...
  2. Select LizMap plugin from Not installed list
  3. Install plugin

Documentation

Translation

You can use the Makefile to update and compile the strings for translation.

# Update strings
make transup

# Compile
make transcompile

License

Version: MPL 2.0/GPL 2.0/LGPL 2.1

The contents of this file are subject to the Mozilla Public License Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/

Alternatively, the contents of this file may be used under the terms of either of the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of either the GPL or the LGPL, and not to allow others to use your version of this file under the terms of the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL or the LGPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL.

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

API

You can use the lizmap_api class of lizmap.py to get the Lizmap JSON configuration for a specific project.

For example:

import sys,os
qgisPrefixPath = "/usr/local/"
sys.path.append(os.path.join(qgisPrefixPath, "share/qgis/python/"))
sys.path.append(os.path.join(qgisPrefixPath, "share/qgis/python/plugins/"))
os.environ["QGIS_DEBUG"] = '-1'
os.environ['QGIS_PREFIX_PATH'] = qgisPrefixPath

from qgis.core import QgsApplication
QgsApplication.setPrefixPath(qgisPrefixPath, True)
app = QgsApplication([], False)
app.initQgis()

# Run the lizmap config exporter
from lizmap import lizmap
project_path = '/home/mdouchin/test_a_sup.qgs'
lv = lizmap.LizmapConfig(project_path)
if lv:
    # get the JSON content with default values
    json_content = lv.to_json()

    # OR:

    # get the JSON content with user defined values
    my_global_options = {
        'mapScales': [1000, 2500, 5000, 10000, 25000, 50000, 100000, 250000], # set the map scales
        'osmMapnik': True, # add the OSM mapnik baselayer
        'osmStamenToner': True, # add the OSM Stamen Toner baselayer
        'print': True # activate the print tool
    }
    my_layer_options = {
        'MY LAYER NAME': {
            'title': 'My new title', # change title
            'popup': True, # active popup
            'cached': True, # activate server cache
            'singleTile': False, # set tiled mode on
            'imageFormat': "image/jpeg", # set image format
            'toggled': False # do not display the layer at project startup
        }
    }
    json_content = lv.to_json(
        p_global_options=my_global_options,
        p_layer_options=my_layer_options
    )
    print(json_content)

    # get the configuration as dictionary
    dic_content = lv.lizmap_json_config

# Exit
QgsApplication.exitQgis()
app.exit()