WFS data servers provide the ability to access vector spatial information via a remote connection. Although you can use ‘Spatial Manager’ User Data Sources (UDS) to access this type of servers, it is interesting to know that these servers return data in GML format

Import GML data from WFS servers

Import GML data from WFS servers

‘Spatial Manager’ includes two spatial data providers to access WFS (Web Feature Service) servers, one of them based on OSGeo FDO and the other based on GDAL/OGR

'Spatial Manager' data providers

‘Spatial Manager’ data providers

However, as mentioned, the content returned by these servers is structured in GML (Geography Markup Language) format. Since you can also directly import GML files using ‘Spatial Manager’, if you experience any connection or access problems to the WFS server you can use the technique described below

Let’s use the following WFS server as an example:

https://www.baysis.bayern.de/gis/services/wfs/BAYSIS_Strassenbestand/MapServer/WFSServer?

To get the Layers (Tables) provided by this server, you can enter the following URL in any Internet browser:

https://www.baysis.bayern.de/gis/services/wfs/BAYSIS_Strassenbestand/MapServer/WFSServer?service=wfs&request=GETCAPABILITIES

In the GML formatted text returned by the server, you can search for “FeatureType” and “Name” nodes. These are the names that must be added as parameters to access each Layer (see below):

XMLLayersList

To access the Layer data, enter the following URL in any Internet browser:

https://www.baysis.bayern.de/gis/services/wfs/BAYSIS_Strassenbestand/MapServer/WFSServer?service=wfs&request=GETFEATURE&typename=STRBESTAND_WFS:Fahrstreifen&maxFeatures=50&startIndex=1000

You can now copy to the clipboard the GML content returned by the browser, paste it into any text editor, save this file with the GML (or XML) extension and import it using ‘Spatial Manager’. If your browser gives you the possibility to do so, you can also directly save the content of the page in a file with GML (or XML) extension. It’s that simple. Try it by yourself

In the sample URL above, the maxFeatures parameter limits the number of elements to read to 50, and the startIndex parameter points to the element 1000 as the first element to read. You can modify these parameters according to your needs or remove them if you want to read the whole layer (beware of the size)


Note:

In some servers, like the one in the example above, the specification of the WFS version is optional, but in others servers this parameter is mandatory. You can get the version (or versions) supported by the server using the same URL indicated above for the Layer search and locating the identifier “AcceptVersions”

XMLAcceptVersions

If it is necessary (or even optional) to include the version number, you can define the parameter as in the following example:

https://www.baysis.bayern.de/gis/services/wfs/BAYSIS_Strassenbestand/MapServer/WFSServer?service=wfs&request=GETFEATURE&typename=STRBESTAND_WFS:Fahrstreifen&maxFeatures=50&startIndex=1000&version=2.0.0


Learn more about import spatial data in ‘Spatial Manager’:

Warning: Some of the features discussed here are available in the Standard and/or Professional editions only