[Qgis-developer] RE: [Qgis-user] WMS in python?
Rob McCulley
RMcCulley at county24.com
Thu Nov 13 15:54:06 EST 2008
> -----Original Message-----
> From: Martin Dobias [mailto:wonder.sk at gmail.com]
> Sent: Monday, March 03, 2008 6:17 PM
> To: Rob McCulley
> Cc: Qgis-user at qgis.org
> Subject: Re: [Qgis-user] WMS in python?
>
> On Mon, Mar 3, 2008 at 9:08 PM, Rob McCulley <RMcCulley at county24.com>
> wrote:
> >
> > Can a WMS Layer be added to an application built using the python
> bindings?
> >
> >
> >
> > I've tried to do it using a few variations of parameters with the
> > QgsDataSourceURI(), but my lyr.isValid() is always false.
> >
> >
> >
> > Can I add a WMS Layer using the python bindings, and if so, how?
>
> It *should* be possible. There's a following constructor (available
> also from python) of raster layers which is used in case of WMS:
>
> QgsRasterLayer(int dummy,
> const QString & baseName = QString(),
> const QString & path = QString(),
> const QString & providerLib = QString(),
> const QStringList & layers = QStringList(),
> const QStringList & styles = QStringList(),
> const QString & format = QString(),
> const QString & crs = QString(),
> const QString & proxyHost = QString(),
> int proxyPort = 80,
> const QString & proxyUser = QString(),
> const QString & proxyPass = QString());
>
> I have never done something with WMS so can't supply you with a
> working example, but to get an idea how to fill in the parameters, see
> QgisApp::addWmsLayer() and debug output from QgisApp::addRasterLayer()
> in src/app/qgisapp.cpp.
>
> Regards
> Martin
I've revisited this again, and haven't managed to get it working yet.
Anyone have any experience with adding a WMS layer using the python
bindings?
I've tried a few different things, but nothing successful. I'm not sure
what values I should be giving for format, styles or crs. For the path,
I've been using the web address (http://localhost:35000).
Any Ideas?
Rob McCulley
More information about the Qgis-developer
mailing list