[Qgis-developer] kickstart wms dialog with wms url

Richard Duivenvoorde rdmailings at duif.net
Sat Mar 9 06:19:18 PST 2013


Hi Devs,

I'm thinking about using our national catalog server (csw) together with 
next-gis csw plugin to preview available WMS layers.

Making it easier to 'preview' a wms-service from a csw (catalog 
service), I thought to make it possible to kickstart the addwms dialog.

That is:
1) start it with only a wms-url (NOT in its current connectionlist)
2) make it do a normal getcapability request and show available layers
3) user can then view a layer by clicking on one of the layers and 
choose 'add' (the normal way)

But I encountered some problems trying to do that. Please correct me if 
I'm wrong or (if you can) provide an alternative for my strategy:

If I understand correctly my plan is not working. Because in the normal 
way to create/add a new wms connection, QGIS makes it store the 
connection information into the global Settings, so this 'connection' 
are for example available when you are going to add a layer.

But I thought to NOT store these connections, because I do not want to 
pollute my wms connections with all kind of connections I may not want 
to keep. Besides this, coming from a csw dialog, I have not given a name 
to the connection yet also.

Another problem for me seems to be that to make a new wmsconnection you 
always have to go through the QgsNewHttpConnection class which is a 
visual dialog (while for my purpose it would be nice if I could 
'silently' make my temporal connection?

Am I correct in this? Or am I missing something?

What would be the best way to implement this? Maybe create a temporary 
connection (named 'temporarily connection (save if you want to save it) 
), and discard it later (or let the user save it in between)?

Regards,

Richard

PS: I could off course take a shortcut and only use the uri + layername 
to add a rasterlayer via the 'addrasterlayer'-api. But then I would skip 
the getcapability step which makes it possible to check other layers in 
the service, and see if my image-type and crs are available etc...


More information about the Qgis-developer mailing list