18.1. QGIS ca și Client de Date OGC¶
Open Geospatial Consortium (OGC) este o organizatie internațională, având ca membri mai mult de 300 de organizații comerciale, guvernamentale, non-profit și de cercetare din întreaga lume. Membrii săi dezvoltă și implementează standarde și servicii pentru conținut geospațial, de prelucrare și de schimb a datelor GIS.
Describing a basic data model for geographic features, an increasing number of specifications are developed by OGC to serve specific needs for interoperable location and geospatial technology, including GIS. Further information can be found at https://www.opengeospatial.org/.
Specificațiile OGC importante, acceptate de către QGIS sunt:
WMS — Web Map Service (Client WMS/WMTS)
WMTS — Web Map Tile Service (Client WMS/WMTS)
WFS — Web Feature Service (Client WFS și WFS-T)
WFS-T — Web Feature Service - Transactional (Client WFS și WFS-T)
WCS — Web Coverage Service (Client WCS)
WPS — Web Processing Service
CSW — Serviciu de Catalogare pentru Web
SFS — Simple Features for SQL (Straturi PostGIS)
GML — Limbaj cu Marcaje Geografice
Serviciile OGC sunt tot mai mult utilizate pentru a interschimba datele geospațiale între diferitele implementări GIS, sau între depozitele de date. QGIS are de-a face cu specificațiile de mai sus din punctul de vedere al unui client, fiind SFS (prin sprijinirea furnizorului de date PostgreSQL / PostGIS, v. secțiunea Straturi PostGIS).
18.1.1. Client WMS/WMTS¶
18.1.1.1. Privire de ansamblu asupra suportului WMS¶
În prezent, QGIS poate acționa ca un client WMS care înțelege serverele WMS 1.1, 1.1.1 și 1.3. În special, acesta a fost testat cu servere accesibile publicului, cum ar fi DEMIS.
Un server WMS acționează asupra cererilor din partea clientului (cum ar fi QGIS) pentru o hartă raster cu o anumită extindere, set de straturi, stil de simbolizare, și transparență. Serverul WMS își consultă apoi sursele de date locale, rasterizează harta, și o trimite înapoi la client, într-un format raster. Pentru QGIS, acest format va fi, de obicei, JPEG sau PNG.
WMS este mai degrabă un serviciu generic REST (Transfer de Stare de Reprezentare), decât un serviciu Web matur. De fapt, puteți lua ca atare adresele URL generate de QGIS și să le utilizați într-un browser web, pentru a obține aceleași imagini pe care QGIS le folosește intern. Acest lucru poate fi util pentru depanare, deoarece există mai multe mărci de servere WMS pe piață, și toate au propria interpretare a standardului WMS.
Straturile WMS pot fi adăugate pur și simplu, atât timp cât: știți URL-ul de acces la serverul WMS, ați stabilit o conexiune validă la acel server, iar serverul înțelege ptotocolul HTTP, ca mecanism de transport al datelor.
Additionally, QGIS will cache your WMS responses (i.e. images) for 24h as long as the GetCapabilities request is not triggered. The GetCapabilities request is triggered everytime the Connect button in the Add Layer(s) from WMS(T) Server dialog is used to retrieve the WMS server capabilities. This is an automatic feature meant to optimize project loading time. If a project is saved with a WMS layer, the corresponding WMS tiles will be loaded from the cache the next time the project is opened as long as they are no older than 24H.
18.1.1.2. Privire de ansamblu asupra suportului WMTS¶
QGIS poate acționa, de asemenea, ca un client WMTS. WMTS reprezintă un standard OGC pentru distribuirea de seturi de plăcuțe ale datelor geospațiale. Acesta constituie un mod mai rapid și mai eficient de a distribui date, comparativ cu WMS, deoarece în cazul WMTS seturile de plăcuțe sunt pre-generate, iar clientul solicită numai transmiterea lor, nu și producerea acestora. O cerere WMS implică, de regulă, atât generarea cât și transmiterea datelor. Un exemplu bine-cunoscut al unui standard de bază non-OGC, pentru vizualizarea de date geospațiale cu ajutorul plăcuțelor, este Google Maps.
Pentru a afișa datele la o varietate de scări, apropiate de ceea ce și-ar putea dori utilizatorul, seturile de plăcuțe WMTS sunt produse la mai multe niveluri de scări diferite, și sunt puse la dispoziția clientului GIS pentru a le apela.
Această diagramă ilustrează conceptul seturilor de plăcuțe:

Fig. 18.1 Conceptul seturilor de plăcuțe WMTS:¶
Cele două tipuri de interfețe WMTS, pe care QGIS le acceptă, sunt Key-Value-Pairs (KVP) și REST. Aceste două interfețe sunt diferite, și trebuie să le specificați în QGIS în mod diferit.
Pentru a avea acces la un serviciu WMTS KVP, un utilizator QGIS trebuie să deschidă interfața WMS/WMTS și să adăuge următorul șir la adresa URL a serviciului de plăcuțe WMTS:
"?SERVICE=WMTS&REQUEST=GetCapabilities"
Un exemplu al acestui tip de adresă este
https://opencache.statkart.no/gatekeeper/gk/gk.open_wmts?\ service=WMTS&request=GetCapabilities
Pentru testare, stratul topo2 din acest WMTS funcționează bine. Adăugarea acestui șir indică faptul că se va utiliza un serviciu web WMTS în locul unui serviciu WMS.
Serviciul RESTful WMTS are o formă diferită de adresă URL, simplă. Formatul recomandat de OGC este:
{WMTSBaseURL}/1.0.0/WMTSCapabilities.xml
This format helps you to recognize that it is a RESTful address. A RESTful WMTS is accessed in QGIS by simply adding its address in the WMS setup in the URL field of the form. An example of this type of address for the case of an Austrian basemap is https://maps.wien.gv.at/basemap/1.0.0/WMTSCapabilities.xml.
Notă
You can still find some old services called WMS-C. These services are quite similar
to WMTS (i.e., same purpose but working a little bit differently). You can manage
them the same as you do WMTS services. Just add ?tiled=true
at the end
of the url. See https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification for more
information about this specification.
Când citiți WMTS, vă puteți gândi adesea și la WMS-C.
18.1.1.3. Selectarea serverelor WMS/WMTS¶
Prima dată când utilizați funcțiunea WMS din QGIS nu există servere definite.
Begin by clicking the Add WMS layer button on the
toolbar, or selecting .
The dialog Add Layer(s) from a Server for adding layers from the WMS server appears. You can add some servers to play with by clicking the Add Default Servers button. This will add two WMS demo servers for you to use: the WMS servers of the DM Solutions Group and Lizardtech. To define a new WMS server in the Layers tab, select the New button. Then enter the parameters to connect to your desired WMS server, as listed in table_OGC_wms:
Tabelul OGC 1: Parametri de conectare WMS
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
Network & Proxy tab.
There, you can add your proxy settings and enable them by setting
Use proxy for web access. Make sure that you select the correct
proxy type from the Proxy type
drop-down menu.
O dată ce noua conexiune de server WMS a fost creată, aceasta va fi păstrată pentru viitoarele sesiuni QGIS.
Sfat
Despre URL-urile Server-ului WMS
Be sure, when entering the WMS server URL, that you have the base URL only.
For example, you shouldn’t have fragments such as request=GetCapabilities
or version=1.0.0
in your URL.
Atenționare
Entering username and password in the Authentication tab will keep unprotected credentials in the connection configuration. Those credentials will be visible if, for instance, you shared the project file with someone. Therefore, it’s advisable to save your credentials in a Authentication configuration instead (configurations tab). See Sistem de Autentificare for more details.
18.1.1.4. Încărcarea Straturilor WMS/WMTS¶
Once you have successfully filled in your parameters, you can use 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 lower left of the WMS dialog.
Your screen should now look a bit like figure_OGC_add_wms, which shows the response provided by the European Soil Portal WMS server.

Fig. 18.2 Dialogul pentru adăugarea unui server WMS, arătând straturile sale disponibile¶
Codificare Imagine
The Image encoding section lists the formats that are supported by both the client and server. Choose one depending on your image accuracy requirements.
Sfat
Codificare Imagine
Veți descoperi că, de obicei, un server WMS vă oferă posibilitatea de a alege codificarea imaginii sub formă de JPEG sau PNG. JPEG este un format de compresie cu pierderi, în timp ce PNG reproduce fidel datele raster originale.
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 five times the data transfer requirement compared with PNG.
Utilizați PNG dacă doriți reprezentări precise ale datelor originale, și nu vă deranjează cerințele crescute de transfer de date.
Opțiuni
The Options area of the dialog provides a text field where you can add a Layer name for the WMS layer. This name will appear in the legend after loading the layer.
Mai jos de numele stratului, puteți defini Dimensiunea plăcuței, în ncazul în care doriți să setați mărimea plăcuțelor (ex.: 256x256), pentru divizarea cererii WMS.
Limitarea entităților pentru GetFeatureInfo definește ce entități de pe server vor fi interogate.
If you select a WMS from the list, a field with the default projection provided by the mapserver appears. If the Change… button is active, you can click on it and change the default projection of the WMS to another CRS provided by the WMS server.
Finally you can activate Use contextual WMS-Legend if the
WMS Server supports this feature. Then only the relevant legend for your current map view extent
will be shown and thus will not include legend items for things you can’t see in the current map.
Ordinea straturilor
The Layer Order tab lists the selected layers available from the current connected WMS server. You may notice that some layers are expandable; this means that the layer can be displayed in a choice of image styles.
Puteți selecta mai multe straturi simultan, dar numai un singur stil pentru fiecare strat. Atunci când sunt selectate mai multe straturi, acestea vor fi combinate în serverul WMS, după care vor fi transmise către QGIS toate o dată.
Sfat
Ordinea straturilor WMS
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 change the overlay order, you can use the Layer Order tab.
Transparenţă
In this version of QGIS, the Global transparency setting from the Layer Properties is hard coded to be always on, where available.
Sfat
Transparenţa stratului WMS
Disponibilitatea transparenței pentru imaginile WMS depinde de codificarea folosită pentru imagini: formatele PNG și GIF acceptă transparența, în timp ce pentru JPEG acest lucru nu este posibil.
Sistemul de Coordonate de Referință
Un sistem de referință de coordonate (CRS) este o terminologie OGC pentru o proiecție QGIS.
Fiecare strat WMS poate fi prezentat în mai multe CRS-uri, în funcție de capacitatea serverului WMS.
To choose a CRS, select Change… and a dialog similar to the one shown in Fig. 10.3 will appear. The main difference with the WMS version of the dialog is that only those CRSs supported by the WMS server will be shown.
18.1.1.5. Căutare server¶
Within QGIS, you can search for WMS servers. Figure_OGC_search shows the Server Search tab with the Add Layer(s) from a Server dialog.

Fig. 18.3 Dialogul pentru căutarea, după unele cuvinte cheie, a serverelor WMS¶
As you can see, it is possible to enter a search string in the text field and hit the Search button. After a short while, the search result will be populated into the list below the text field. Browse the result list and inspect your search results within the table. To visualize the results, select a table entry, press the Add Selected Row to WMS List button and change back to the Layers tab. QGIS has automatically updated your server list, and the selected search result is already enabled in the list of saved WMS servers in the Layers tab. 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.
Practic, această opțiune este un front-end pentru API-ul de la http://geopole.org.
18.1.1.6. Seturi de plăcuțe¶
Atunci când se utilizează servicii WMTS (Cached WMS), cum ar fi
https://opencache.statkart.no/gatekeeper/gk/gk.open_wmts?\
service=WMTS&request=GetCapabilities
you are able to browse through the Tilesets tab given by the server.
Additional information like tile size, formats and supported CRS are listed in
this table. In combination with this feature, you can use the tile scale slider
by selecting ( or ), then choosing Tile Scale Panel. This gives you the
available scales from the tile server with a nice slider docked in.
18.1.1.7. Folosirea instrumentului de identificare¶
După ce ați adăugat un server WMS, în cazul în care orice strat primit de la serverul WMS este interogabil, puteți folosi instrumentul Identificare pentru a selecta un pixel de pe canevasul hărții. O interogare a serverului WMS are loc pentru fiecare selecție efectuată. Rezultatele interogării sunt returnate sub formă de text simplu. Formatarea acestui text depinde de particularitățile serverului WMS folosit.
Selecția Formatului
If multiple output formats are supported by the server, a combo box with supported formats is automatically added to the identify results dialog and the selected format may be stored in the project for the layer.
Suport pentru formatul GML
The Identify tool supports WMS server response
(GetFeatureInfo) in GML format (it is called Feature in the QGIS GUI in this context).
If „Feature” format is supported by the server and selected, results of the Identify
tool are vector features, as from a regular vector layer. When a single feature
is selected in the tree, it is highlighted in the map and it can be copied to
the clipboard and pasted to another vector layer. See the example setup of the
UMN Mapserver below to support GetFeatureInfo in GML format.
# in layer METADATA add which fields should be included and define geometry (example):
"gml_include_items" "all"
"ows_geometries" "mygeom"
"ows_mygeom_type" "polygon"
# Then there are two possibilities/formats available, see a) and b):
# a) basic (output is generated by Mapserver and does not contain XSD)
# in WEB METADATA define formats (example):
"wms_getfeatureinfo_formatlist" "application/vnd.ogc.gml,text/html"
# b) using OGR (output is generated by OGR, it is send as multipart and contains XSD)
# in MAP define OUTPUTFORMAT (example):
OUTPUTFORMAT
NAME "OGRGML"
MIMETYPE "ogr/gml"
DRIVER "OGR/GML"
FORMATOPTION "FORM=multipart"
END
# in WEB METADATA define formats (example):
"wms_getfeatureinfo_formatlist" "OGRGML,text/html"
Vizualizarea Proprietăţilor
După ce ați adăugat un server WMS, îi puteți vizualiza proprietățile printr-un clic-dreapta pe el, în legendă, și prin selectarea
.Fila Metadatelor
The tab Metadata 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 (see OPEN-GEOSPATIAL-CONSORTIUM in Literatură și Referințe Web), but here are a few handy definitions:
Proprietăţile serverului
Versiunea WMS — Versiunea WMS acceptată de server.
Formatele de Imagine — Lista tipurilor MIME pentru care serverul poate răspunde la momentul desenării hărții. QGIS acceptă oricare dintre formatele recunoscute de bibliotecile Qt, acestea fiind de obicei
image/png
șiimage/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.
Proprietăţile stratului
Selectat — Indiferent dacă acest strat a fost sau nu selectat, atunci când serverul său a fost adăugat în acest proiect.
Vizibil — Indiferent dacă acest strat este selectat ca vizibil în legendă (nu este utilizat încă în această versiune de QGIS).
Poate Identifica — Dacă acest strat va returna un rezultat, sau nu, atunci când este folosit instrumentul Identificare asupra lui.
Poate fi Transparent — Dacă sau nu, un strat poate fi randat cu transparență. Această versiune de QGIS va folosi întotdeauna transparența dacă această setare este
Yes
, și dacă codificarea imaginii acceptă transparență.Se Poate Mări — Dacă acest strat poate fi, sau nu, mărit de către server. Această versiune de QGIS presupune că toate straturile WMS au această opțiune setată pe
Yes
. Straturile cu deficiențe pot fi randate în mod eronat.Numărare în Cascadă — Serverele WMS pot acționa ca un proxy pentru alte servere WMS, pentru a obține datele raster ale unui strat. Această intrare arată de câte ori este transmisă cererea pentru acest strat către alte servere WMS, pentru obținerea unui rezultat.
Lățime fixă, Înălțime Fixă — Dacă acest strat are, sau nu, dimensiuni fixe. Această versiune de QGIS presupune că toate straturile WMS nu au această opțiune setată. Straturile cu deficiențe pot fi randate în mod eronat.
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:84BoundingBox
.Disponibil în CRS — Proiecțiile în care poate fi randat acest strat de către serverul WMS. Acestea sunt prezentate în format nativ WMS.
Disponibil în stil — Stilurile de imagine în care poate fi randat acest strat de către serverul WMS.
18.1.1.8. Show WMS legend graphic in table of contents and layout¶
The QGIS WMS data provider is able to display a legend graphic in the table of contents» layer list and in the print layout. The WMS legend will be shown only if the WMS server has GetLegendGraphic capability and the layer has getCapability url specified, so you additionally have to select a styling for the layer.
If a legendGraphic is available, it is shown below the layer. It is little and you have to click on it to open it in real dimension (due to QgsLegendInterface architectural limitation). Clicking on the layer’s legend will open a frame with the legend at full resolution.
In the print layout, the legend will be integrated at it’s original (downloaded) dimension. Resolution of the legend graphic can be set in the item properties under
to match your printing requirements.The legend will display contextual information based on your current scale. The WMS legend will be shown only if the WMS server has GetLegendGraphic capability and the layer has getCapability url specified, so you have to select a styling.
18.1.1.9. Limitările clientului WMS¶
În această versiune de QGIS, clientul WMS nu include orice funcționalitate posibilă. Unele dintre cele mai notabile excepții sunt prezentate în continuare.
Editarea Setărilor Stratului WMS
Once you’ve completed the Add WMS layer procedure,
there is no way to change the settings. A work-around is to delete the layer
completely and start again.
Cerințele de autentificare ale Serverelor WMS
Currently, publicly accessible and secured WMS services are supported. The secured WMS servers can be accessed by public authentication. You can add the (optional) credentials when you add a WMS server. See section Selectarea serverelor WMS/WMTS for details.
Sfat
Accesarea straturilor OGC securizate
If you need to access secured layers with secured methods other than basic authentication, you can use InteProxy as a transparent proxy, which does support several authentication methods. More information can be found in the InteProxy manual at https://inteproxy.wald.intevation.org.
Sfat
QGIS WMS Mapserver
Începând cu versiunea 1.7.0, QGIS include propria implementare de Mapserver WMS 1.3.0. Citiți mai multe despre acest lucru în capitolul QGIS ca și Server de Date OGC.
18.1.2. Client WCS¶
Un Serviciu de Acoperire Web (WCS) oferă acces la datele raster, în forme care sunt utile pentru randarea pe partea clientului, ca date de intrare în modelele științifice, precum și pentru alți clienți. WCS poate fi comparat cu WFS și WMS. La fel ca și instanțele serviciilor WMS și WFS, un WCS permite clienților să aleagă porțiuni din informațiile serverelor, bazate pe constrângeri spațiale și pe alte criterii de interogare.
QGIS has a native WCS provider and supports both version 1.0 and 1.1 (which are significantly different), but currently it prefers 1.0, because 1.1 has many issues (i.e., each server implements it in a different way with various particularities).
Furnizorul nativ WCS se ocupă de toate cererile de rețea, utilizând toate setările de rețea standard ale QGIS (în special proxy). Este, de asemenea, posibil de selectat modul cache («întotdeauna cache», «se preferă cache», «se preferă rețeaua», «mereu rețea»), furnizorul acceptând, de asemenea, selecția poziției în timp, dacă domeniul temporal este oferit de server.
Atenționare
Entering username and password in the Authentication tab will keep unprotected credentials in the connection configuration. Those credentials will be visible if, for instance, you shared the project file with someone. Therefore, it’s advisable to save your credentials in a Authentication configuration instead (configurations tab). See Sistem de Autentificare for more details.
18.1.3. Client WFS și WFS-T¶
În |qg|, un strat WFS se comportă destul de mult ca oricare alt strat vectorial. Puteți identifica și selecta entitățile, pentru a le vizualiza în tabelul de atribute. Începând cu versiunea QGIS 1.6, editarea WFS-T este, de asemenea, acceptată.
În general, adăugarea unui strat WFS este foarte similară cu procedura utilizată pentru WMS. Diferența este că nu există servere standard definite, așa că trebuie să-l adăugăm pe al nostru.
Încărcarea unui strat WFS
As an example, we use the Gateway Geomatics WFS server and display a layer. https://demo.gatewaygeomatics.com/cgi-bin/wfs_gateway?REQUEST=GetCapabilities&VERSION=1.0.0&SERVICE=WFS
To be able to load a WFS Layer we create a connection to the WFS server first.
Open the Data Source Manager dialog by pressing the
Open Data Source Manager button
Click on New… to open the Create a New WFS Connection dialog
Enter
Gateway Geomatics
as nameEnter the URL (see above)
Fig. 18.4 Creating a connection to a WFS server¶
In the WFS settings dialog, you can:
Indicate the WFS version of the server. If unknown, press the Detect button to automatically retrieve it.
Define the maximum number of features retrieved in a single GetFetFeature request. If empty, no limit is set.
Invert axis orientation.
And depending on the WFS version:
Force to Ignore axis orientation (WFS 1.1/WFS 2.0)
Enable feature paging and specify the maximum number of features to retrieve with Page size. If no limit is defined, then the server default is applied.
Atenționare
Entering username and password in the Authentication tab will keep unprotected credentials in the connection configuration. Those credentials will be visible if, for instance, you shared the project file with someone. Therefore, it’s advisable to save your credentials in an Authentication configuration instead (Configurations tab). See Sistem de Autentificare for more details.
Press OK to create the connection.
Rețineți că orice setări proxy stabilite în preferințe sunt, de asemenea, recunoscute.
Now we are ready to load WFS layers from the above connection.
Choose «Gateway Geomatics» from the Server Connections
drop-down list.
Click Connect
Select the Parks layer in the list
You can also choose whether to:
Click Add to add the layer to the map.

Fig. 18.5 Adăugarea unui strat WFS¶
You’ll notice the download progress is visualized in the lower left of the QGIS main window. Once the layer is loaded, you can identify and select a couple of features and view the attribute table.
Notă
QGIS supports different versions of the WFS protocol, with background download and progressive rendering, on-disk caching of downloaded features and version autodetection.
Sfat
Găsirea Serverelor WFS
Puteți găsi servere suplimentare WFS cu ajutorul Google, sau a motorului de căutare preferat. Există o serie de liste cu URL-uri publice, unele dintre ele întreținute, altele nu.