QGIS User Guide - OSGeo Server | Working with OGC Data
7 WORKING WITH OGC DATA
7. Working with OGC Data
QGIS supports WMS and WFS as data sources. The support is native; WFS is implemented as a plugin.
7.1. What is OGC Data
The Open Geospatial Consortium (OGC), is an international organization with more than 300 commercial, governmental, nonprofit and research organisations worldwide. Its members develop and implement standards for geospatial content and services, GIS data processing and exchange.
Describing a basic data model for geographic features an increasing number of specifications are developed to serve specific needs for interoperable location and geospatial technology, including
GIS. Further information can be found under http://www.opengeospatial.org/ .
Important OGC specifications are:
• WMS - Web Map Service
• WFS - Web Feature Service
WCS - Web Coverage Service
CAT - Web Catalog Service
SFS - Simple Features for SQL
• GML - Geography Markup Language
OGC services are increasingly being used to exchange geospatial data between different GIS implementations and data stores. QGIS can now deal with three of the above specifications, being SFS
(though support of the PostgreSQL / PostGIS data provider, see Section
7.2. WMS Client
7.2.1. Overview of WMS Support
QGIS currently can act as a WMS client that understands WMS 1.1, 1.1.1 and 1.3 servers. It has particularly been tested against publicly accessible servers such as DEMIS and JPL OnEarth.
WMS servers act upon requests by the client (e.g. QGIS) for a raster map with a given extent, set of layers, symbolisation style, and transparency. The WMS server then consults its local data sources,
QGIS 1.4.0 User Guide 90
WMS Client rasterizes the map, and sends it back to the client in a raster format. For QGIS this would typically be
JPEG or PNG.
WMS is generically a REST (Representational State Transfer) service rather than a fully-blown Web
Service. As such, you can actually take the URLs generated by QGIS and use them in a web browser to retrieve the same images that QGIS uses internally. This can be useful for troubleshooting, as there are several brands of WMS servers in the market and they all have their own interpretation of the WMS standard.
WMS layers can be added quite simply, as long as you know the URL to access the WMS server, you have a serviceable connection to that server, and the server understands HTTP as the data transport mechanism.
7.2.2. Selecting WMS Servers
The first time you use the WMS feature, there are no servers defined. You can begin by clicking the menu.
Add WMS layer button inside the toolbar, or through the Layer >
Add WMS Layer...
The dialog Add Layer(s) from a Server for adding layers from the WMS server pops up. Fortunately you can add some servers to play with by clicking the Add default servers button. This will add at least three WMS servers for you to use, including the NASA (JPL) WMS server. To define a new WMS server in the Server Connections section, select New . Then enter the parameters to connect to your desired WMS server, as listed in table
Table 4: WMS Connection Parameters
A name for this connection. This name will be used in the Server Connections drop-down box so that you can distinguish it from other WMS Servers.
URL of the server providing the data. This must be a resolvable host name; the same format as you would use to open a telnet connection or ping a host.
Username Username to access a secured WMS-server. This parameter is optional
Password Password for a basic authentificated WMS-server. This parameter is optional.
If you need to set up a proxy-server to be able to receive WMS-services from the internet, you can add your proxy-server in the options.
Choose menu Settings >
Options and click on the Proxy tab.
There you can add your proxy-settings and enable them by setting the x Use proxy for web access . Make sure that you select the correct proxy-type from the
QGIS 1.4.0 User Guide 91
7 WORKING WITH OGC DATA
Proxy type dropdown menu.
Once the new WMS Server connection has been created, it will be preserved for future QGIS sessions.
Tip 25 O
Be sure, when entering in the WMS server URL, that you have the base URL. For example, you shouldn’t have fragments such as request=GetCapabilities or version=1.0.0
in your URL.
7.2.3. Loading WMS Layers
Once you have successfully filled in your parameters you can select the Connect button to retrieve the capabilities of the selected server. This includes the Image encoding, Layers, Layer Styles and
Projections. Since this is a network operation, the speed of the response depends on the quality of your network connection to the WMS server. While downloading data from the WMS server, the download progress is visualized in the left bottom of the WMS Plugin dialog.
Your screen should now look a bit like Figure
JPL OnEarth WMS server.
Figure 31: Dialog for adding a WMS server, showing its available layers
QGIS 1.4.0 User Guide 92
The Image encoding section now lists the formats that are supported by both the client and server.
Choose one depending on your image accuracy requirements.
Tip 26 I
You will typically find that a WMS server offers you the choice of JPEG or PNG image encoding. JPEG is a lossy compression format, whereas PNG faithfully reproduces the raw raster data.
Use JPEG if you expect the WMS data to be photographic in nature and/or you don’t mind some loss in picture quality. This trade-off typically reduces by 5 times the data transfer requirement compared to PNG.
Use PNG if you want precise representations of the original data, and you don’t mind the increased data transfer requirements.
The Layers section lists the layers available from the selected WMS server. You may notice that some layers are expandible, this means that the layer can be displayed in a choice of image styles.
You can select several layers at once, but only one image style per layer. When several layers are selected, they will be combined at the WMS Server and transmitted to QGIS in one go.
Tip 27 WMS L
In this version of QGIS, WMS layers rendered by a server are overlaid in the order listed in the Layers section, from top to bottom of the list. If you want to overlay layers in the opposite order, then you can select
Add WMS layer a second time, choose the same server again, and select the second group of layers that you want to overlay the first group.
In this version of QGIS, the transparency setting is hard-coded to be always on, where available.
Tip 28 WMS L
The availability of WMS image transparency depends on the image encoding used: PNG and GIF support transparency, whilst JPEG leaves it unsupported.
Coordinate Reference System
A Coordinate Reference System (CRS) is the OGC terminology for a QGIS Projection.
Each WMS Layer can be presented in multiple CRSs, depending on the capability of the WMS server.
You may notice that the x changes in the Coordinate Reference System (x available) header as you select and deselect layers from the Layers section.
To choose a CRS, select Change...
and a screen similar to Figure
QGIS 1.4.0 User Guide 93
7 WORKING WITH OGC DATA
The main difference with the WMS version of the screen is that only those CRSs supported by the
WMS Server will be shown.
Tip 29 WMS P
For best results, make the WMS layer the first layer you add to your project. This allows the project projection to inherit the CRS you used to render the WMS layer. On-the-fly projection (see Section
used to fit any subsequent vector layers to the project projection. In this version of QGIS, if you add a WMS layer later, and give it a different CRS to the current project projection, unpredictable results can occur.
Within QGIS 1.1.X you can search for WMS-servers. Figure
shows the newly created search tab with the Add Layer(s) from a Server -dialog.
Figure 32: Dialog for searching WMS servers after some keywords
As you can see it is possible to enter a search-string in the textfield an hit the Search button.
After a short while the search result will be populated into the tab below the textfield.
Browse the result list and inspect your searchresults within the table. To visualize the results, select an table entry, press the Add selected row to WMS-list button and change back to the server tab.
QGIS 1.4.0 User Guide 94
QGIS automatically has updated your server list and the selected searchresult is already enabled in the list of saved WMS-servers.
You only need to request the list of layers by clicking the Connect button.
This option is quite handy when you want to search maps by specific keywords.
Basically this option is a frontend to the API of http://geopole.org
7.2.5. Using the Identify Tool
Once you have added a WMS server, and if any layer from a WMS server is queryable, you can then use the
Identify tool to select a pixel on the map canvas. A query is made to the WMS server for each selection made.
The results of the query are returned in plain text. The formatting of this text is dependent on the particular WMS server used.
7.2.6. Viewing Properties
Once you have added a WMS server, you can view its properties by right-clicking on it in the legend, and selecting Properties .
The Metadata tab displays a wealth of information about the WMS server, generally collected from the Capabilities statement returned from that server.
Many definitions can be gleaned by reading the WMS standards [? ], [? ], but here are a few handy definitions:
– WMS Version - The WMS version supported by the server.
– Image Formats - The list of MIME-types the server can respond with when drawing the map. QGIS supports whatever formats the underlying Qt libraries were built with, which is typically at least image/png and image/jpeg
– Identity Formats - The list of MIME-types the server can respond with when you use the
Identify tool. Currently QGIS supports the text-plain type.
QGIS 1.4.0 User Guide 95
7 WORKING WITH OGC DATA
– Selected - Whether or not this layer was selected when its server was added to this project.
– Visible - Whether or not this layer is selected as visible in the legend. (Not yet used in this version of QGIS.)
– Can Identify - Whether or not this layer will return any results when the Identify tool is used on it.
– Can be Transparent - Whether or not this layer can be rendered with transparency. This version of QGIS will always use transparency if this is Yes and the image encoding supports transparency .
– Can Zoom In - Whether or not this layer can be zoomed in by the server. This version of QGIS assumes all WMS layers have this set to Yes. Deficient layers may be rendered strangely.
– Cascade Count - WMS servers can act as a proxy to other WMS servers to get the raster data for a layer. This entry shows how many times the request for this layer is forwarded to peer WMS servers for a result.
– Fixed Width, Fixed Height - Whether or not this layer has fixed source pixel dimensions.
This version of QGIS assumes all WMS layers have this set to nothing. Deficient layers may be rendered strangely.
– WGS 84 Bounding Box - The bounding box of the layer, in WGS 84 coordinates. Some
WMS servers do not set this correctly (e.g. UTM coordinates are used instead). If this is the case, then the initial view of this layer may be rendered with a very “zoomed-out” appearance by QGIS. The WMS webmaster should be informed of this error, which they may know as the WMS XML elements LatLonBoundingBox , EX_GeographicBoundingBox or the CRS:84
– Available in CRS - The projections that this layer can be rendered in by the WMS server.
These are listed in the WMS-native format.
– Available in style - The image styles that this layer can be rendered in by the WMS server.
7.2.7. WMS Client Limitations
Not all possible WMS Client functionality had been included in this version of QGIS. Some of the more notable exceptions follow:
QGIS 1.4.0 User Guide 96
Editing WMS Layer Settings
Once you’ve completed the tings.
Add WMS layer procedure, there is no ability to change the set-
A workaround is to delete the layer completely and start again.
WMS Servers Requiring Authentication
Currently public accessible and secured WMS-services are supported. The secured WMS-servers can be accessed by public authentification. You can add the (optional) credentials when you add a
WMS-server. See section
Tip 30 A
If you need to access secured layers with other secured methods than basic authentification, you could use
InteProxy as a transparent proxy, which does supports several authentification methods. More information can be found at the InteProxy-manual found on the website http://inteproxy.wald.intevation.org
7.3. WFS Client
In QGIS, a WFS layer behaves pretty much like any other vector layer. You can identify and select features and view the attribute table. An exception is that editing is not supported at this time. To start the WFS plugin you need to open Plugins >
Plugin Manager... , activate the x WFS plugin checkbox and click OK .
Add WFS Layer icon appears next to the WMS icon. Click on it to open the dialog. In
General adding a WFS layer is very similar to the procedure used with WMS. The difference is there are no default servers defined, so we have to add our own.
7.3.1. Loading a WFS Layer
As an example we use the DM Solutions WFS server and display a layer. The URL is: http://www2.dmsolutions.ca/cgi-bin/mswfs_gmap?VERSION=1.0.0&SERVICE= wfs&REQUEST=GetCapabilities
1. Make sure the WFS plugin is loaded; if not, open the Plugin Manager and load it
2. Click on the
Add WFS Layer tool on the plugins toolbar
QGIS 1.4.0 User Guide 97
7 WORKING WITH OGC DATA
3. Click on New
4. Enter Name
DM Solutions as the name
5. Enter the URL (see previous page)
6. Click OK
7. Choose Server Connections DM Solutions
H from the drop-down box
8. Click Connect
9. Wait for the list of layers to be populated
10. Click on the Canadian Land layer
11. Click Add to add the layer to the map
12. Wait patiently for the features to appear
Note that the WFS-plugin also recognizes the proxy-settings you have set in your preferences.
Figure 33: Adding a WFS layer
You’ll notice the download progress is visualized in the left bottom of the QGIS main window. Once the layer is loaded, you can identify and select a province or two and view the attribute table.
Remember this plugin works best with UMN MapServer WFS servers. It still could be, that you might experience random behavior and crashes. You can look forward to improvements in a future version of the plugin.
QGIS 1.4.0 User Guide 98
This means that only WFS 1.0.0 is supported. At this point there have not been many test against over WFS versions implemented in other WFS-servers. If you encounter problems with any other
WFS-server, please do not hesitate to contacting the development team. Please refer to Section
for further information about the mailinglists.
Tip 31 F
You can find additional WFS servers by using Google or your favorite search engine. There are a number of lists with public URLs, some of them maintained and some not.
Tip 32 A
Within the dialog Create a new WFS-connection accidentily described QGIS does not support authenficated WFS-connections yet. Within one of the next releases we expect to also support authenticated
WFS-servers. Meanwhile you could use InteProxy ( http://inteproxy.wald.intevation.org
) for accessing authenticated WFS-servers.
QGIS 1.4.0 User Guide 99
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project