Skip to main content
Tweeted twitter.com/StackGIS/status/848110498755342336
deleted 48 characters in body; edited tags; edited title
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

WFS in PYQGIS: importing Importing all layers available on a server for WFS in PyQGIS?

I'm trying to access data from a WFS-server, E.g. https://geo.barentswatch.no/geoserver/bw/ows?

I manage to import single layers by:

uri = "https://geo.barentswatch.no/geoserver/bw/ows?srsname=EPSG:4326&typename=bw:npdsurveyongoing_latest&version=1.0.0&request=vlayer=QgsVectorLayer"
vlayer = QgsVectorLayer(uri, "bw:npdsurveyongoing_latest", "WFS")
QgsMapLayerRegistry.instance().addMapLayer(vlayer)

However, I want to import all available layers and would like them to automatically to be named by their original typeName. Seems a bit unnecessary to hardcode all names in beforehand accessing the server, but I have been struggling to figure out the codes for this.

Any way to do this in pyqgis? Thank you in advance!

Best reagrds Sigurd

WFS in PYQGIS: importing all layers available on a server

I'm trying to access data from a WFS-server, E.g. https://geo.barentswatch.no/geoserver/bw/ows?

I manage to import single layers by:

uri = "https://geo.barentswatch.no/geoserver/bw/ows?srsname=EPSG:4326&typename=bw:npdsurveyongoing_latest&version=1.0.0&request=vlayer=QgsVectorLayer"
vlayer = QgsVectorLayer(uri, "bw:npdsurveyongoing_latest", "WFS")
QgsMapLayerRegistry.instance().addMapLayer(vlayer)

However, I want to import all available layers and would like them to automatically to be named by their original typeName. Seems a bit unnecessary to hardcode all names in beforehand accessing the server, but I have been struggling to figure out the codes for this.

Any way to do this in pyqgis? Thank you in advance!

Best reagrds Sigurd

Importing all layers available on server for WFS in PyQGIS?

I'm trying to access data from a WFS-server, E.g. https://geo.barentswatch.no/geoserver/bw/ows?

I manage to import single layers by:

uri = "https://geo.barentswatch.no/geoserver/bw/ows?srsname=EPSG:4326&typename=bw:npdsurveyongoing_latest&version=1.0.0&request=vlayer=QgsVectorLayer"
vlayer = QgsVectorLayer(uri, "bw:npdsurveyongoing_latest", "WFS")
QgsMapLayerRegistry.instance().addMapLayer(vlayer)

However, I want to import all available layers and would like them to automatically to be named by their original typeName. Seems a bit unnecessary to hardcode all names in beforehand accessing the server, but I have been struggling to figure out the codes for this.

Any way to do this in pyqgis?

Source Link
Sigurd
  • 111
  • 5

WFS in PYQGIS: importing all layers available on a server

I'm trying to access data from a WFS-server, E.g. https://geo.barentswatch.no/geoserver/bw/ows?

I manage to import single layers by:

uri = "https://geo.barentswatch.no/geoserver/bw/ows?srsname=EPSG:4326&typename=bw:npdsurveyongoing_latest&version=1.0.0&request=vlayer=QgsVectorLayer"
vlayer = QgsVectorLayer(uri, "bw:npdsurveyongoing_latest", "WFS")
QgsMapLayerRegistry.instance().addMapLayer(vlayer)

However, I want to import all available layers and would like them to automatically to be named by their original typeName. Seems a bit unnecessary to hardcode all names in beforehand accessing the server, but I have been struggling to figure out the codes for this.

Any way to do this in pyqgis? Thank you in advance!

Best reagrds Sigurd