Saturday, 7 November 2015

Adding OpenWeatherMap WMS layer using PyQGIS?


I would like to add in QGIS real time weather data.


I found this link and this link 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?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...