OGC Web Map Service

http://opengeospatial.org/standards/wms

Publish map images from data stored on server to the client.

Parameters for the map:

  • Image size
  • Required layers
  • Area extent
  • Image format
  • Coordinate reference system
  • (Layer style)

Note

How does the server and the client communicate

Client sends the request encoded in URL to some known server address. Example of WMS endpoint:

http://my.maps-domain.org/wms

The parameters for the request are stored at the end of the URL starting by ? sign. Each parameter and it’s value are separated with & sign:

http://my.maps-domain.org/wms?parameter1=value1&parameter2=value2&...

The response from the server is either data itself (like PNG or JPEG image) or XML-encoded document

WMS Server should be able to handle 3 types of requests:

  • GetCapabilities - retrieves server metadata (encoded as XML document)
  • GetMap - retrieves PNG or JPEG image
  • GetFeatureInfo - allows the client ask for attribute data identified by “mouse click” - single point

QGIS project deployment

  1. Open Project properties dialog and go to OWS Server tab

    ../_images/09_ows.png
  2. Click Service capabilities checkbox and fill needed items

    ../_images/10_publishing.png

    Fig. 71 Fill short name, title, organisation, … WMS Capabilities: click Use Current Canvas Extent. Add supported CRSs.

  3. Select all vector layers for OGC WFS and raster layers for OGC WCS services

    ../_images/11_publishing.png

    Fig. 72 Enable WFS and WCS layers, you can limit image size for WMS too.

  4. Launch test configuration

    ../_images/12_publishing.png

    Fig. 73 Launch test configuration.

  5. Save the project as file next to the `publication-data` directory

  6. Copy publication-data along with the QGIS project file to /mnt/publish/YOUR_NAME/ directory

    ../_images/16_copy.png
  7. Let’s open our created QGIS project with raster and vector data!

  8. In our case, the OGC OWS server is living in GIS.Lab server instance

  9. We have to point the qgis_mapserver.fcgi program to our project - we have to add map parameter to the URL

    map=cepicky/ISPRS_summerschool_ospublication.qgs

  10. Now we can ask for metadata from the server:

    service=wms
    request=getcapabilities
    

    Each request parameter is to be separated in form:

    key=value
    

    Parameters are separated using & sign.

    All parameters are separated from the file name using ? sign:

    http://147.32.26.113:91/cgi-bin/qgis_mapserv.fcgi?
    map=cepicky/ISPRS_summerschool_ospublication.qgs&
    service=wms&
    request=getcapabilities
    

    Putting it to one line

  11. Now we can get the map

    http://147.32.26.113:91/cgi-bin/qgis_mapserv.fcgi?map=cepicky/ISPRS_summerschool_ospublication.qgs&service=WMS&request=getmap&width=800&height=600&crs=epsg:32633&layers=Hydrology&format=image/png&bbox=527542,5.44521e+06,539858,5.45313e+06

    ../_images/17_getmap.png

What have we done?

../_images/deploying.png

Fig. 74 Deploying of the project

Load Published WMS service to QGIS

Note

It’s worth to start a new empty QGIS project for this step to avoid confusion by all the layers you may have in the layer switcher.

  1. In QGIS, you can now add new WMS server

    ../_images/13_wms_client.png

    Fig. 75 Add new WMS layer - New server with URL http://147.32.26.113:91/cgi-bin/qgis_mapserv.fcgi?map=cepicky/ISPRS_summerschool_ospublication.qgs. The rest of parameters leave untouched.

  2. Connect to the server and select some layer, choose PNG image format, create name

    ../_images/14_wms_addlayer.png
  3. Now you may have to see a new raster layer, published from our WMS server

    ../_images/deploying.png