level2-gis / gisapp

Extended QGIS Web Client
GNU General Public License v3.0
53 stars 31 forks source link

Add Overlay WMS layer #84

Closed UnoRed1 closed 6 years ago

UnoRed1 commented 6 years ago

I would like to connect the WMS layer as an Overlay. For this, I need to execute this query in PostgreSQL, right?

INSERT INTO layers(name, display_name, type, definition) VALUES ('arso_kcn', 'Aglomeracije', 'WMS', '{ "url": "http://gis.arso.gov.si/geoserver/ows", "params": { "VERSION": "1.1.0",
"LAYERS": "arso:AGLOM_KCN", "STYLES": "", "FORMAT": "image/png", "TRANSPARENT": true }, "options": { "opacity": 0.7, "buffer": 0, "displayOutsideMaxExtent": true, "isBaseLayer": false, "singleTile": false } }');

uprel commented 6 years ago

This is just an example. You need to set at least correct "url" and "LAYERS" parameters.

Instead of query you can use functionalities of gisportal for database management of gisapp.

UnoRed1 commented 6 years ago

I need to add a WMS layer: http://pkk5.rosreestr.ru/arcgis/services/Cadastre/CadastreWMS/MapServer/WMSServer

In "LAYERS" should I specify a name for the layer?

I get this code: INSERT INTO layers(name, display_name, type, definition) VALUES ('arso_kcn', 'Aglomeracije', 'WMS', '{ "url": "http://pkk5.rosreestr.ru/arcgis/services/Cadastre/CadastreWMS/MapServer/WMSServer", "params": { "VERSION": "1.1.0", "LAYERS": "PKK", "STYLES": "", "FORMAT": "image/png", "TRANSPARENT": true }, "options": { "opacity": 0.7, "buffer": 0, "displayOutsideMaxExtent": true, "isBaseLayer": false, "singleTile": false } }');

After running the query, I get the line: string

Did I do it right? How now to connect a layer to the project?

uprel commented 6 years ago

That looks OK, I would also change name and display name to match your layer (I forgot to mention that earlier).

Adding this layer to your project can be done two ways:

  1. Manually with pgAdmin (directly in table or running SQL queries): Layer ID is 8, so you need to add to projects table to the row of your project, number 8 into field base_layers_ids or into extra_layers_ids. Differences between this two is that user can select only one baselayer and one or more extra layers.
  2. Much, much easier way is to install gisportal - https://github.com/uprel/gisportal, create administrator user and you have web interface for managing all this.
UnoRed1 commented 6 years ago

It works. Thank you so much!