[Qgis-user] Adding an OpenWeatherMap WMS layer using PyQGIS
Xristos Xristoou
saxri89 at gmail.com
Mon Apr 23 12:28:50 PDT 2018
I would like to add in QGIS real time weather data.
I found this link
<https://www.packtpub.com/mapt/book/application_development/9781783984985/5/ch05lvl1sec98/adding-real-time-weather-data-from-openweathermap>
and this link
<https://www.gislounge.com/adding-real-time-weather-data-from-openweathermap-qgis-python-programming-cookbook/>
and I tried to follow the example, but without any success.
I've added a WMS weather data layer for precipitation to the QGIS map, as
follows:
First, the parameters for the service:
service = 'crs=EPSG:900913&dpiMode=7&featureCount=10&format=image/png&layers=precipitation&styles=&url=http://wms.openweathermap.org/service'
Next, create the raster layer, specifying WMS as the type:
rlayer = QgsRasterLayer(service, "precip", "wms")
Finally, add the precipitation layer to the map:
QgsMapLayerRegistry.instance().addMapLayers([rlayer])
the example didn't show any error in the code and no data was added to the
weather layer either, I'm not sure why?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20180423/83e1f5e8/attachment.html>
More information about the Qgis-user
mailing list