2

I want to create a plugin that adds a raster layer (published on geoserver) on QGIS via PYQGIS. As long as i enable the advertised option in the layer publish panel the layer is easily added on the QGIS. But when I unchecked the advertised option, the layer is not added. So, please suggest a method through which i can create a custom plugin that adds published WMS layer (whose layer preview is OFF) on the QGIS desktop?

8
  • The whole point of making a layer unadvertised is to prevent people from loading it,
    – Ian Turton
    Jul 1 '19 at 8:54
  • So is there no way to do this. It is working in ArcGIS
    – Gaurav
    Jul 1 '19 at 9:30
  • why would you want to load an unadvertised layer?
    – Ian Turton
    Jul 1 '19 at 9:37
  • Actually we want to share our vector data in raster form with a client as a service.So i published the vector data on my geoserver and now the client wants to visualize the data on QGIS so we thought to make a custom plugin that does it all
    – Gaurav
    Jul 1 '19 at 9:41
  • QGIS can read a WMS layer just fine, simply click advertised in GeoServer so it shows up in the GetCapabilities list of layers and all WMS clients can use it.
    – Ian Turton
    Jul 1 '19 at 10:39
1

A "good" client like qgis will query the getcapabilities response to find out what layers are available, unadvertised layers will not show up in that list. A lazy client will rely on you adding the layer name you want (leaflet, arcgis) - an attacker can read you leaflet JS and will know the layer name and so you have no security.

Therefore you should use the security system built into GeoServer to restrict access to your layer in a standardised way.

0

Either,

Make a copy of the GeoServer GetCapabilities response, add the layer(s) you want. Save the static file to a location on a web server. Point QGIS to this static file.

Or,

Configure a GDAL WMS driver configuration file and add your required layers there.

See https://gdal.org/drivers/raster/wms.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.