Outdated version of the documentation. Find the latest one here.

QGIS ca și Server de Date OGC

QGIS Server is an open source WMS 1.3, WFS 1.0.0 and WCS 1 1.1.1 implementation that, in addition, implements advanced cartographic features for thematic mapping. The QGIS Server is a FastCGI/CGI (Common Gateway Interface) application written in C++ that works together with a web server (e.g., Apache, Lighttpd). It has Python plugin support allowing for fast and efficient development and deployment of new features. The original development of QGIS Server was funded by the EU projects Orchestra, Sany and the city of Uster in Switzerland.

QGIS Server uses QGIS as back end for the GIS logic and for map rendering. Furthermore, the Qt library is used for graphics and for platform-independent C++ programming. In contrast to other WMS software, the QGIS Server uses cartographic rules as a configuration language, both for the server configuration and for the user-defined cartographic rules.

Atât timp cât QGIS desktop și QGIS Server folosesc aceleași biblioteci de vizualizare, hărțile care sunt publicate pe web arătând la fel ca și în GIS desktop.

In the following sections, we will provide a sample configuration to set up a QGIS Server on Debian/Ubuntu Linux. For user contributed installation instructions on other platforms or distributions, we recommend reading one of the following URLs:

Instalare QGIS Server pe Debian/Ubuntu

At this point, we will give a short and simple sample installation how-to for a minimal working configuration using Apache2 on Debian Squeeze (or with negligible variations on Ubuntu 14.04). Many other OSs provide packages for QGIS Server, too. If you have to build it all from source, please refer to the URLs above.

În primul rând, adăugați următorul depozit GIS pentru debian:

$ cat /etc/apt/sources.list.d/debian-gis.list
deb http://qgis.org/debian trusty main
deb-src http://qgis.org/debian trusty main

$ # Add keys
$ sudo gpg --keyserver keyserver.ubuntu.com --recv-key 3FF5FFCAD71472C4
$ sudo gpg --export --armor 3FF5FFCAD71472C4 | sudo apt-key add -

$ # Update package list
$ sudo apt-get update && sudo apt-get upgrade

Acum, instalați QGIS Server:

$ sudo apt-get install qgis-server python-qgis

Installation of a HelloWorld example plugin for testing the servers. You create a directory to hold server plugins. This will be specified in the virtual host configuration and passed on to the server through an environment variable:

$ sudo mkdir -p /opt/qgis-server/plugins
$ cd /opt/qgis-server/plugins
$ sudo wget https://github.com/elpaso/qgis-helloserver/archive/master.zip
$ # In case unzip was not installed before:
$ sudo apt-get install unzip
$ sudo unzip master.zip
$ sudo mv qgis-helloserver-master HelloServer

Instalați serverul Apache într-o gazdă virtuală separată, care monitorizează portul 80. Activați modulul de rescriere pentru a permite autentificarea antetelor HTTP BASIC:

$ sudo a2enmod rewrite
$ cat /etc/apache2/conf-available/qgis-server-port.conf
Listen 80
$ sudo a2enconf qgis-server-port

Aceasta este configurația gazdei virtuale, stocate în /etc/apache2/sites-available/001-qgis-server.conf :

<VirtualHost *:80>
  ServerAdmin [email protected]
  DocumentRoot /var/www/html

  ErrorLog ${APACHE_LOG_DIR}/qgis-server-error.log
  CustomLog ${APACHE_LOG_DIR}/qgis-server-access.log combined

  # Longer timeout for WPS... default = 40
  FcgidIOTimeout 120
  FcgidInitialEnv LC_ALL "en_US.UTF-8"
  FcgidInitialEnv PYTHONIOENCODING UTF-8
  FcgidInitialEnv LANG "en_US.UTF-8"
  FcgidInitialEnv QGIS_DEBUG 1
  FcgidInitialEnv QGIS_SERVER_LOG_FILE /tmp/qgis-000.log
  FcgidInitialEnv QGIS_SERVER_LOG_LEVEL 0
  FcgidInitialEnv QGIS_PLUGINPATH "/opt/qgis-server/plugins"

  # Needed for QGIS HelloServer plugin HTTP BASIC auth
  <IfModule mod_fcgid.c>
      RewriteEngine on
      RewriteCond %{HTTP:Authorization} .
      RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  </IfModule>

  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  <Directory "/usr/lib/cgi-bin">
      AllowOverride All
      Options +ExecCGI -MultiViews +FollowSymLinks
      # for apache2 > 2.4
      Require all granted
      #Allow from all
  </Directory>
 </VirtualHost>

Acum activați gazda virtuală și reporniți Apache:

$ sudo a2ensite 001-qgis-server
$ sudo service apache2 restart

Testați serverul cu plugin-ul HelloWorld:

$ wget -q -O - "http://localhost/cgi-bin/qgis_mapserv.fcgi?SERVICE=HELLO"
HelloServer!

Puteți arunca o privire la comanda GetCapabilities a serverului QGIS la: http://localhost/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities

Tip

Dacă lucrați cu o entitate care are multe noduri, atunci modificarea și adăugarea altei entități va eșua. În acest caz, este posibilă introducerea următorului cod în fișierul 001-qgis-server.conf file:

<IfModule mod_fcgid.c>
FcgidMaxRequestLen 26214400
FcgidConnectTimeout 60
</IfModule>

Crearea unui server WMS/WFS/WCS dintr-un proiect QGIS

Pentru a crea un nou Server WMS, WFS or sau WCS QGIS, trebuie să creăm un fișier de proiect QGIS, în care să existe câteva date. În continuare, vom folosi fișierul shape ‘Alaska’, al setului de date eșantion din QGIS. În QGIS definiți culorile și stilurile straturilor, precum și CRS-ul proiectului, dacă nu ați făcut deja acest lucru.

Figure Server 2:

../../../_images/ows_server_definition.png

Definițiile unui proiect de Server WMS/WFS/WCS QGIS

Then, go to the OWS Server menu of the Project ‣ Project Properties dialog and provide some information about the OWS in the fields under Service Capabilities. This will appear in the GetCapabilities response of the WMS, WFS or WCS. If you don’t check checkbox Service capabilities, QGIS Server will use the information given in the wms_metadata.xml file located in the cgi-bin folder.

Warning

If you’re using the QGIS project with styling based on SVG files using relative paths then you should know that the server considers the path relative to its qgis_mapserv.fcgi file (not to the qgs file). So, if you deploy a project on the server and the SVG files are not placed accordingly, the output images may not respect the Desktop styling. To ensure this doesn’t happen, you can simply copy the SVG files relative to the qgis_mapserv.fcgi. You can also create a symbolic link in the directory where the fcgi file resides that points to the directory containing the SVG files (on Linux/Unix).

Capabilităţi WMS

In the WMS capabilities section, you can define the extent advertised in the WMS GetCapabilities response by entering the minimum and maximum X and Y values in the fields under Advertised extent. Clicking Use Current Canvas Extent sets these values to the extent currently displayed in the QGIS map canvas. By checking checkbox CRS restrictions, you can restrict in which coordinate reference systems (CRS) QGIS Server will offer to render maps. Use the signPlus button below to select those CRSs from the Coordinate Reference System Selector, or click Used to add the CRSs used in the QGIS project to the list.

If you have print composers defined in your project, they will be listed in the GetProjectSettings response, and they can be used by the GetPrint request to create prints, using one of the print composer layouts as a template. This is a QGIS-specific extension to the WMS 1.3.0 specification. If you want to exclude any print composer from being published by the WMS, check checkbox Exclude composers and click the signPlus button below. Then, select a print composer from the Select print composer dialog in order to add it to the excluded composers list.

If you want to exclude any layer or layer group from being published by the WMS, check checkbox Exclude Layers and click the signPlus button below. This opens the Select restricted layers and groups dialog, which allows you to choose the layers and groups that you don’t want to be published. Use the Shift or Ctrl key if you want to select multiple entries.

Puteți primi rezultatul solicitării GetFeatureInfo sub formă de text simplu, XML și GML. XML este implicit, textul sau formatul GML depinzând de formatul de ieșire ales pentru cererea GetFeatureInfo.

If you wish, you can check checkbox Add geometry to feature response. This will include in the GetFeatureInfo response the geometries of the features in a text format. If you want QGIS Server to advertise specific request URLs in the WMS GetCapabilities response, enter the corresponding URL in the Advertised URL field. Furthermore, you can restrict the maximum size of the maps returned by the GetMap request by entering the maximum width and height into the respective fields under Maximums for GetMap request.

If one of your layers uses the Map Tip display (i.e. to show text using expressions) this will be listed inside the GetFeatureInfo output. If the layer uses a Value Map for one of its attributes, this information will also be shown in the GetFeatureInfo output.

QGIS acceptă următoarele cereri pentru serviciul WMS:

  • GetCapabilities
  • GetMap
  • GetFeatureInfo
  • GetLegendGraphic (profilul SLD)

  • DescribeLayer (profilul SLD)

  • GetStyles (profilul QGIS personalizat)

Capabilităţi WFS

In the WFS capabilities area you can select the layers you want to publish as WFS, and specify if they will allow update, insert and delete operations. If you enter a URL in the Advertised URL field of the WFS capabilities section, QGIS Server will advertise this specific URL in the WFS GetCapabilities response.

QGIS acceptă următoarele cereri pentru serviciul WFS:

  • GetCapabilities
  • DescribeFeatureType
  • GetFeature
  • Transaction

Capabilităţi WCS

In the WCS capabilities area, you can select the layers that you want to publish as WCS. If you enter a URL in the Advertised URL field of the WCS capabilities section, QGIS Server will advertise this specific URL in the WCS GetCapabilities response.

Now, save the session in a project file alaska.qgs. To provide the project as a WMS/WFS, we create a new folder /usr/lib/cgi-bin/project with admin privileges and add the project file alaska.qgs and a copy of the qgis_mapserv.fcgi file - that’s all.

Acum vom testa proiectul nostru WMS, WFS și WCS. Adăugați în QGIS serviciile WMS, WFS și WCS, așa cum este descris în Încărcarea Straturilor WMS/WMTS, Client WFS și WFS-T și Client WCS, apoi încărcați datele. URL-ul este:

http://localhost/cgi-bin/project/qgis_mapserv.fcgi

QGIS acceptă următoarele cereri pentru serviciul WCS:

  • GetCapabilities
  • DescribeCoverage
  • GetCoverage

Stocarea cererilor GetCapabilities

In order to improve response time, QGIS Server caches the responses to the GetCapabilities requests. When such a request comes, QGIS Server is caching the response and marking the cache valid. At the same time, it watches if the project file changes. If the project is changed then the cache is marked as invalid and QGIS Server waits for a new request in order to recreate the cache.

Reglarea fină a OWS-ului dvs.

For vector layers, the Fields menu of the Layer ‣ Properties dialog allows you to define for each attribute if it will be published or not. By default, all the attributes are published by your WMS and WFS. If you don’t want a specific attribute to be published, uncheck the corresponding checkbox in the WMS or WFS column.

You can overlay watermarks over the maps produced by your WMS by adding text annotations or SVG annotations to the project file. See the Annotation Tools section in Instrumente generale for instructions on creating annotations. For annotations to be displayed as watermarks on the WMS output, the Fixed map position check box in the Annotation text dialog must be unchecked. This can be accessed by double clicking the annotation while one of the annotation tools is active. For SVG annotations, you will need either to set the project to save absolute paths (in the General menu of the Project ‣ Project Properties dialog) or to manually modify the path to the SVG image so that it represents a valid relative path.

Configurarea serverului și parametrii acceptați

QGIS Server supports some vendor parameters and requests that greatly enhance the possibilities of customising its behavior. The following paragraphs list the vendor parameters and the environment variables supported by the server.

Parametri suplimentari acceptați de toate tipurile de cerere

  • FILE_NAME parameter: if set, the server response will be sent to the client as a file attachment with the specified file name.

  • MAP parameter: Similar to MapServer, the MAP parameter can be used to specify the path to the QGIS project file. You can specify an absolute path or a path relative to the location of the server executable (qgis_mapserv.fcgi). If not specified, QGIS Server searches for .qgs files in the directory where the server executable is located.

    Exemplu:

    http://localhost/cgi-bin/qgis_mapserv.fcgi?\
      REQUEST=GetMap&MAP=/home/qgis/mymap.qgs&...

Note

You can define a QGIS_PROJECT_FILE as an environment variable to tell the server executable where to find the QGIS project file. This variable will be the location where QGIS will look for the project file. If not defined it will use the MAP parameter in the request and finally look at the server executable directory.

Parametri suplimentari acceptați de cererea WMS GetMap

In the WMS GetMap request, QGIS Server accepts a couple of extra parameters in addition to the standard parameters according to the OGC WMS 1.3.0 specification:

  • Parametrul DPI: parametrul DPI poate fi folosit pentru a specifica rezoluția de ieșire solicitată.

    Exemplu:

    http://localhost/cgi-bin/qgis_mapserv.fcgi?REQUEST=GetMap&DPI=300&...
  • OPACITIES parameter: Opacity can be set on layer or group level. Allowed values range from 0 (fully transparent) to 255 (fully opaque).

    Exemplu:

    http://localhost/cgi-bin/qgis_mapserv.fcgi?\
      REQUEST=GetMap&LAYERS=mylayer1,mylayer2&OPACITIES=125,200&...
  • FILTER parameter: (Available in QGIS 1.8 and above). Subsets of layers

    can be selected with the FILTER parameter. Syntax is basically the same as for the QGIS subset string. However, there are some restrictions to avoid SQL injections into databases via QGIS server:

    Text strings need to be enclosed with quotes (single quotes for strings, double quotes for attributes) A space between each word / special character is mandatory. Allowed Keywords and special characters are ‘AND’,’OR’,’IN’,’=’,’<’,’>=’, ‘>’,’>=’,’!=*,’(‘,’)’. Semicolons in string expressions are not allowed

    Exemplu:

    http://myserver.com/cgi/qgis_mapserv.fcgi?REQUEST=GetMap&LAYERS=mylayer1,mylayer2&FILTER=mylayer1:"OBJECTID" = 3;mylayer2:'text' = 'blabla'&....

Note

It is possible to make attribute searches via GetFeatureInfo and omit the X/Y parameter if a FILTER is there. QGIS server then returns info about the matching features and generates a combined bounding box in the xml output.

  • SELECTION parameter: (Available in QGIS 1.8 and above)

    Vector features can be selected by passing comma separated lists with feature ids in GetMap and GetPrint.

    Exemplu:

    http://myserver.com/cgi/qgis_mapserv.fcgi?REQUEST=GetMap&LAYERS=mylayer1,mylayer2&SELECTION=mylayer1:3,6,9;mylayer2:1,5,6&...

Parametri suplimentari acceptați de cererea WMS GetFeatureInfo

QGIS Server WMS GetFeatureInfo requests supports the following extra optional parameters to define the tolerance for point, line and polygon layers:

  • FI_POINT_TOLERANCE parameter: Tolerance for point layers GetFeatureInfo request, in pixels.
  • FI_LINE_TOLERANCE parameter: Tolerance for linestring layers GetFeatureInfo request, in pixels.
  • FI_POLYGON_TOLERANCE parameter: Tolerance for polygon layers GetFeatureInfo request, in pixels.

Cererea GetPrint

QGIS server has the capability to create print composer output in pdf or pixel format. Print composer windows in the published project are used as templates. In the GetPrint request, the client has the possibility to specify parameters of the contained composer maps and labels.

Exemplu:

The published project has two composer maps. In the GetProjectSettings response, they are listed as possible print templates:

<WMS_Capabilities>
...
<ComposerTemplates xsi:type="wms:_ExtendedCapabilities">
<ComposerTemplate width="297" height="210" name="Druckzusammenstellung 1">
<ComposerMap width="171" height="133" name="map0"/>
<ComposerMap width="49" height="46" name="map1"/></ComposerTemplate>
</ComposerTemplates>
...
</WMS_Capabilities>

Clientul are acum informațiile pentru a solicita o ieșire la imprimantă:

http://myserver.com/cgi/qgis_mapserv.fcgi?...&REQUEST=GetPrint&TEMPLATE=Druckzusammenstellung 1&map0:EXTENT=xmin,ymin,xmax,ymax&map0:ROTATION=45&FORMAT=pdf&DPI=300

Parametrii din cererea GetPrint sunt:

  • <map_id>:EXTENT gives the extent for a composer map as xmin,ymin,xmax,ymax.
  • <map_id>:ROTATION map rotation in degrees
  • <map_id>:GRID_INTERVAL_X, <map_id>:GRID_INTERVAL_Y Grid line density for a composer map in x- and y-direction
  • <map_id>:SCALE Sets a mapscale to a composer map. This is useful to ensure scale based visibility of layers and labels even if client and server may have different algorithms to calculate the scale denominator
  • <map_id>:LAYERS, <map_id>:STYLES possibility to give layer and styles list for composer map (useful in case of overview maps which should have only a subset of layers)

Cererea GetLegendGraphics

Several additional parameters are available to change the size of the legend elements:

  • BOXSPACE space between legend frame and content (mm)
  • LAYERSPACE spațiul vertical dintre straturi (mm)

  • LAYERTITLESPACE vertical space between layer title and items following (mm)
  • SYMBOLSPACE spațiul vertical, dintre simbol și elementul următor (mm)

  • ICONLABELSPACE horizontal space between symbol and label text (mm)
  • SYMBOLWIDTH lățimea ferestrei de previzualizare a simbolului (mm)

  • SYMBOLHEIGHT înălțimea ferestrei de previzualizare a simbolului (mm)

These parameters change the font properties for layer titles and item labels:

  • LAYERFONTFAMILY / ITEMFONTFAMILY font family for layer title / item text
  • LAYERFONTBOLD / ITEMFONTBOLD ‘TRUE’ to use a bold font
  • LAYERFONTSIZE / ITEMFONTSIZE Font size in point
  • LAYERFONTITALIC / ITEMFONTITALIC ‘TRUE’ to use italic font
  • LAYERFONTCOLOR / ITEMFONTCOLOR Hex color code (e.g. #FF0000 for red)
  • LAYERTITLE / RULELABEL (from QGIS 2.4) set them to ‘FALSE’ to get only the legend graphics without labels

Contest based legend. These parameters let the client request a legend showing only the symbols for the features falling into the requested area:

  • BBOX the geographical area for which the legend should be built
  • CRS / SRS the coordinate reference system adopted to define the BBOX coordinates
  • WIDTH / HEIGHT if set these should match those defined for the GetMap request, to let QGIS Server scale symbols according to the map view image size.

Contest based legend features are based on the UMN MapServer implementation:

Cererea GetProjectSettings

This request type works similar to GetCapabilities, but it is more specific to QGIS Server and allows a client to read additional information which is not available in the GetCapabilities output:

  • Vizibilitatea inițială a straturilor

  • information about vector attributes and their edit types
  • information about layer order and drawing order
  • lista straturilor publicate în WFS

Export DXF

It is possible to export layers in the DXF format using the GetMap Request. Only layers that have read access in the WFS service are exported in the DXF format. Here is a valid REQUEST and a documentation of the available parameters:

http://your.server.address/wms/liegenschaftsentwaesserung/abwasser_werkplan?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=Haltungen,Normschacht,Spezialbauwerke&STYLES=&CRS=EPSG%3A21781&BBOX=696136.28844801,245797.12108743,696318.91114315,245939.25832905&WIDTH=1042&HEIGHT=811&FORMAT=application/dxf&FORMAT_OPTIONS=MODE:SYMBOLLAYERSYMBOLOGY;SCALE:250&FILE_NAME=werkplan_abwasser.dxf

Parametri:

  • FORMAT=application/dxf
  • FILE_NAME=yoursuggested_file_name_for_download.dxf
  • FORMAT_OPTIONS=v. opțiunile de mai jos, key:value perechi separate prin punct și virgulă

Parametri FORMAT_OPTIONS:

  • SCALE:scale to be used for symbology rules, filters and styles (not an actual scaling of the data - data remains in the original scale).
  • MODE:NOSYMBOLOGY|FEATURESYMBOLOGY|SYMBOLLAYERSYMBOLOGY corresponds to the three export options offered in the QGIS Desktop DXF export dialog.
  • LAYERSATTRIBUTES:yourcolumn_with_values_to_be_used_for_dxf_layernames - if not specified, the original QGIS layer names are used.
  • În cazul în care se activează USE_TITLE_AS_LAYERNAME, titlul stratului va servi drept nume pentru strat.

Parametri suplimentari acceptați de cererea WFS GetFeature

In the WFS GetFeature request, QGIS Server accepts two extra parameters in addition to the standard parameters according to the OGC WFS 1.0.0 specification:

  • GeometryName parameter: this parameter can be used to get the extent or the centroid as the geometry or no geometry if none if used (ie attribute only). Allowed values are extent, centroid or none.
  • StartIndex parameter: STARTINDEX is standard in WFS 2.0, but it’s an extension for WFS 1.0.0 which is the only version implemented in QGIS Server. STARTINDEX can be used to skip some features in the result set and in combination with MAXFEATURES will provide for the ability to use WFS GetFeature to page through results. Note that STARTINDEX=0 means start with the first feature, skipping none.

Jurnalizarea Serverului QGIS

Pentru a jurnaliza cererile transmise serverului, setați următoarele variabile de mediu:

  • QGIS_SERVER_LOG_FILE: Specificați calea și numele fișierului. Asigurați-vă că serverul are permisiuni adecvate pentru a scrie în fișier. Fișierul ar trebui să fie creat automat, doar trimiteți niște cereri la server. Dacă nu se află acolo, atunci verificați permisiunile.

  • QGIS_SERVER_LOG_LEVEL: Precizați nivelul de jurnalizare dorit. Valorile disponibile sunt:

    • 0 INFO (se jurnalizează toate cererile),

    • 1 AVERTISMENT,

    • 2 CRITIC (se jurnalizează doar erorile critice, adecvat în scop de producție).

    Exemplu:

    SetEnv QGIS_SERVER_LOG_FILE /var/tmp/qgislog.txt
    SetEnv QGIS_SERVER_LOG_LEVEL 0

Note

  • Când utilizați modulul Fcgid, folosiți FcgidInitialEnv în loc de SetEnv!

  • Jurnalizarea Serverului este activată, de asemenea, în cazul în care executabilul este compilat în modul de lansare ca versiune nouă.

Nume scurte pentru straturi, grupuri și proiecte

O serie de elemente au atât un <Name> cât și un <Titlu>. Numele este reprezentat printr-un șir de caractere, care este utilizat pentru comunicarea de-la-mașină-la-mașină, în timp ce Titlul este folosit pentru comunicarea între utilizatori.

De exemplu, un set de date poate avea Titlul descriptiv “Temperatura Atmosferică Maximă” și să fie solicitat cu ajutorul Numelui abreviat “ATMAX”. Utilizatorul poate seta deja titlul pentru straturi, grupuri și pentru proiect.

Numele OWS se bazează pe numele utilizat în arborele straturilor. Acest nume este mai mult o etichetă pentru uzul utilizatorului, nicidecum un nume pentru comunicarea de-la-mașină-la-mașină.

Serverul QGIS acceptă:

  • linii editabile, pentru nume scurte, în proprietățile straturilor

  • WMS data dialog to layer tree group (short name, title, abstract) By right clicking on a layer group and selecting the Set Group WMS data option you will get:

    Figure set group wms data:

    ../../../_images/set_group_wms_data.png
  • liniile de editare a numelor scurte în proprietățile proiectului- adaugă un validator regex "^[A-Za-z][A-Za-z0-9\._-]*" pentru liniile de editare a numelor scurte, accesibil printr-o metodă statică

  • adaugă un validator regex "^[A-Za-z][A-Za-z0-9\._-]*", pentru liniile de editare a numelor scurte, accesibil printr-o metodă statică

  • adaugă un element TreeName în fullProjectSettings

În cazul în care un nume scurt a fost stabilit pentru straturi, grupuri și proiect, acesta va fi utilizat de QGIS Sever pentru numele stratului.

Connection to service file

In order to make apache aware of the PostgreSQL service file (see the Service connection file section) you need to make your *.conf file look like:

SetEnv PGSERVICEFILE /home/web/.pg_service.conf

<Directory "/home/web/apps2/bin/">
  AllowOverride None
.....

Add fonts to your linux server

Keep in mind that you may use QGIS projects that point to fonts that may not exist by default on other machines. This means that if you share the project, it may look different on other machines (if the fonts don’t exist on the target machine).

In order to ensure this does not happen you just need to install the missing fonts on the target machine. Doing this on desktop systems is usually trivial (double clicking the fonts).

For linux, if you don’t have a desktop environment installed (or you prefer the command line) you need to:

  • On Debian based systems:

    sudo su
    mkdir -p /usr/local/share/fonts/truetype/myfonts && cd /usr/local/share/fonts/truetype/myfonts
    
    # copy the fonts from their location
    cp /fonts_location/* .
    
    chown root *
    cd .. && fc-cache -f -v
  • On Fedora based systems:

    sudo su
    mkdir /usr/share/fonts/myfonts && cd /usr/share/fonts/myfonts
    
    # copy the fonts from their location
    cp /fonts_location/* .
    
    chown root *
    cd .. && fc-cache -f -v

Variabile de mediu

You can configure some aspects of QGIS server by setting environment variables. For example, to set QGIS server on Apache to use /path/to/config/QGIS/QGIS2.ini settings file, add to Apache config:

SetEnv QGIS_OPTIONS_PATH "/path/to/config/"

or, if using fcgi:

FcgidInitialEnv QGIS_OPTIONS_PATH "/path/to/config/"

This is a list of the variables supported by QGIS server:

  • QGIS_OPTIONS_PATH: Specifies the path to the directory with settings. It works the same way as QGIS application –optionspath option. It is looking for settings file in <QGIS_OPTIONS_PATH>/QGIS/QGIS2.ini.
  • QUERY_STRING: The query string, normally passed by the web server. This variable can be useful while testing QGIS server binary from the command line.
  • QGIS_PROJECT_FILE: the .qgs project file, normally passed as a parameter in the query string, you can also set it as an environment variable (for example by using mod_rewrite Apache module).
  • QGIS_SERVER_LOG_FILE: Specificați calea și numele fișierului. Asigurați-vă că serverul are permisiuni adecvate pentru a scrie în fișier. Fișierul ar trebui să fie creat automat, doar trimiteți niște cereri la server. Dacă nu se află acolo, atunci verificați permisiunile.

  • QGIS_SERVER_LOG_LEVEL: Specify desired log level. See Jurnalizarea Serverului QGIS
  • MAX_CACHE_LAYERS: Specify the maximum number of cached layers (default: 100).
  • DISPLAY: This is used to pass (fake) X server display number (needed on Unix-like systems).
  • QGIS_PLUGINPATH: Useful if you are using Python plugins for the server, this sets the folder that is searched for Python plugins.