### Sphinx Doctest Setup and Code Example Source: https://github.com/qgis/qgis-documentation/blob/master/README.md Illustrates how to use Sphinx directives for testing Python code. 'testsetup' is for setup code not shown in docs, and 'testcode' is for the actual code to be tested. ```python .. testsetup:: from qgis.core import QgsCoordinateReferenceSystem .. testcode:: # SRID 4326 is allocated for WGS84 crs = QgsCoordinateReferenceSystem("EPSG:4326") assert crs.isValid() ``` -------------------------------- ### Install pyogctest Source: https://github.com/qgis/qgis-documentation/blob/master/docs/developers_guide/ogcconformancetesting.rst Sets up a virtual environment and installs the pyogctest tool. ```bash virtualenv venv source venv/bin/activate pip install pyogctest ``` -------------------------------- ### Install Apache and mod_fcgid Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/getting_started.rst Install the necessary Apache packages for hosting QGIS Server. ```bash apt install apache2 libapache2-mod-fcgid ``` -------------------------------- ### WFS GetCapabilities URL Example Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/services/wfs.rst Example URL structure for a WFS GetCapabilities request. ```bash http://localhost/qgisserver? SERVICE=WFS &VERSION=1.1.0 &... ``` -------------------------------- ### Start QGIS Server with spawn-fcgi Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/getting_started.rst Manual command to start the QGIS Server process using spawn-fcgi. ```bash spawn-fcgi -s /var/run/qgisserver.socket \ -U www-data -G www-data -n \ /usr/lib/cgi-bin/qgis_mapserv.fcgi ``` -------------------------------- ### Complete metadata.txt Example Source: https://github.com/qgis/qgis-documentation/blob/master/docs/pyqgis_developer_cookbook/plugins/plugins.rst A comprehensive example of a metadata.txt file containing both mandatory and optional fields. ```ini ; the next section is mandatory [general] name=HelloWorld email=me@example.com author=Just Me qgisMinimumVersion=3.0 description=This is an example plugin for greeting the world. Multiline is allowed: lines starting with spaces belong to the same field, in this case to the "description" field. HTML formatting is not allowed. about=This paragraph can contain a detailed description of the plugin. Multiline is allowed, HTML is not. version=version 1.2 tracker=https://bugs.itopen.it repository=https://www.itopen.it/repo ; end of mandatory metadata ; start of optional metadata category=Raster changelog=The changelog lists the plugin versions and their changes as in the example below: 1.0 - First stable release 0.9 - All features implemented 0.8 - First testing release ; Tags are in comma separated value format, spaces are allowed within the ; tag name. ; Tags should be in English language. Please also check for existing tags and ; synonyms before creating a new one. tags=wkt,raster,hello world ; these metadata can be empty, they will eventually become mandatory. homepage=https://www.itopen.it icon=icon.png ; experimental flag (applies to the single version) experimental=True ; deprecated flag (applies to the whole plugin and not only to the uploaded version) deprecated=False ; if empty, it will be automatically set to major version + .99 ; qgisMaximumVersion=3.99 ; Since QGIS 3.8, a comma separated list of plugins to be installed ; (or upgraded) can be specified. ; The example below will try to install (or upgrade) "MyOtherPlugin" version 1.12 ; and any version of "YetAnotherPlugin". ; Both "MyOtherPlugin" and "YetAnotherPlugin" names come from their own metadata's ; name field plugin_dependencies=MyOtherPlugin==1.12,YetAnotherPlugin ``` -------------------------------- ### Install Requirements and Build Documentation Source: https://github.com/qgis/qgis-documentation/blob/master/README.md Installs project dependencies and triggers the HTML build process. ```sh pip install -r REQUIREMENTS.txt ``` ```sh make html ``` -------------------------------- ### Install Transifex CLI Source: https://github.com/qgis/qgis-documentation/blob/master/README.md Install the Transifex command-line client using a provided script. After installation, restart your terminal. ```sh curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash # and restart the terminal ``` -------------------------------- ### Verify QGIS Server Installation Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/getting_started.rst Execute the FCGI binary to confirm the server is correctly installed. ```bash /usr/lib/cgi-bin/qgis_mapserv.fcgi ``` -------------------------------- ### Install NGINX Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/getting_started.rst Install the NGINX web server using the system's package manager. ```bash apt install nginx ``` -------------------------------- ### Install QtCreator on Debian Source: https://github.com/qgis/qgis-documentation/blob/master/docs/developers_guide/qtcreator.rst Use the package manager to install QtCreator and its documentation on Debian-based systems. ```bash sudo apt install qtcreator qtcreator-doc ``` -------------------------------- ### Install QGIS Server packages Source: https://github.com/qgis/qgis-documentation/blob/master/docs/training_manual/qgis_server/install.rst Use the apt package manager to install the QGIS Server and optional Python plugins. ```bash apt install qgis-server --no-install-recommends --no-install-suggests # if you want to install server plugins, also: apt install python3-qgis ``` -------------------------------- ### Enable, Start, and Check Xvfb Service Status Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/getting_started.rst Enables the Xvfb service to start on boot, starts it immediately, and checks its current status. ```bash systemctl enable --now xvfb.service systemctl status xvfb.service ``` -------------------------------- ### WMS GetCapabilities Request Example Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/services/wms.rst Example URL for a WMS GetCapabilities request. This request retrieves metadata about the WMS server. ```bash http://localhost/qgisserver? SERVICE=WMS &VERSION=1.3.0 &REQUEST=GetCapabilities ``` -------------------------------- ### Enable and Start QGIS Server Service Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/getting_started.rst Command to enable and start the systemd service for QGIS Server. ```bash systemctl enable --now qgis-server ``` -------------------------------- ### Enable and Start QGIS Server Service Instances Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/getting_started.rst Enables and starts multiple QGIS Server service instances (1 through 4). ```bash for i in 1 2 3 4; do systemctl enable --now qgis-server@$i.service; done ``` -------------------------------- ### Install Dependencies for English PDF Builds Source: https://github.com/qgis/qgis-documentation/blob/master/README.md Install the XeLaTex compiler and GNU Freefont, which are required for building English PDF documentation. ```shell sudo apt install texlive-xetex fonts-freefont-otf ``` -------------------------------- ### Install HelloWorld plugin manually Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/plugins.rst Commands to create a plugin directory and download the HelloWorld demonstration plugin. ```bash mkdir -p /var/www/qgis-server/plugins cd /var/www/qgis-server/plugins wget https://github.com/elpaso/qgis-helloserver/archive/master.zip unzip master.zip mv qgis-helloserver-master HelloServer ``` -------------------------------- ### Get Y Coordinate of Geometry Vertex Source: https://github.com/qgis/qgis-documentation/blob/master/docs/user_manual/expressions/expression_help/GeometryGroup.rst Retrieves the y-coordinate of a specific vertex within a geometry. Vertex indices start at 0. ```QGIS Expression y_at( geom_from_wkt( 'POINT(4 5)' ), 0 ) ``` -------------------------------- ### Download and Prepare Sample Data Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/getting_started.rst Commands to create a project directory and download the QGIS training dataset. ```bash mkdir /home/qgis/projects/ cd /home/qgis/projects/ wget https://github.com/qgis/QGIS-Training-Data/archive/release_3.22.zip unzip release_3.22.zip mv QGIS-Training-Data-release_3.22/exercise_data/qgis-server-tutorial-data/world.qgs . mv QGIS-Training-Data-release_3.22/exercise_data/qgis-server-tutorial-data/naturalearth.sqlite . ``` -------------------------------- ### Get X Coordinate of Geometry Vertex Source: https://github.com/qgis/qgis-documentation/blob/master/docs/user_manual/expressions/expression_help/GeometryGroup.rst Retrieves the x-coordinate of a specific vertex within a geometry. Vertex indices start at 0. ```QGIS Expression x_at( geom_from_wkt( 'POINT(4 5)' ), 0 ) ``` -------------------------------- ### Get Z-coordinate at Specific Vertex Source: https://github.com/qgis/qgis-documentation/blob/master/docs/user_manual/expressions/expression_help/GeometryGroup.rst Retrieves the z-coordinate of a specified vertex within a geometry. The vertex index starts at 0 and can be negative to count from the end. ```sql z_at(geom_from_wkt('LineStringZ(0 0 0, 10 10 5, 10 10 0)'), 1) ``` -------------------------------- ### Test Setup for All Groups Source: https://github.com/qgis/qgis-documentation/blob/master/docs/documentation_guidelines/cookbook_guidelines.rst Use `.. testsetup:: *` to include setup code that will be applied to all testing groups, ensuring common imports or declarations are available across different tests. ```python from qgis.core import QgsCoordinateReferenceSystem ``` -------------------------------- ### Get M Coordinate by Vertex Index Source: https://github.com/qgis/qgis-documentation/blob/master/docs/user_manual/expressions/expression_help/GeometryGroup.rst Retrieves the M coordinate of a specific vertex in a geometry. Indices start at 0, and negative indices count from the end. ```qgis m_at(geom_from_wkt('LineStringZM(0 0 0 0, 10 10 0 5, 10 10 0 0)'), 1) ``` -------------------------------- ### Extract a slice from an array Source: https://github.com/qgis/qgis-documentation/blob/master/docs/user_manual/expressions/expression_help/Arrays.rst Use array_slice to get a portion of an array. Specify the start and end positions, which are inclusive. Negative indices count from the end of the array. ```QGIS Expression array_slice(array(1,2,3,4,5),0,3) ``` ```QGIS Expression array_slice(array(1,2,3,4,5),0,-1) ``` ```QGIS Expression array_slice(array(1,2,3,4,5),-5,-1) ``` ```QGIS Expression array_slice(array(1,2,3,4,5),0,0) ``` ```QGIS Expression array_slice(array(1,2,3,4,5),-2,-1) ``` ```QGIS Expression array_slice(array(1,2,3,4,5),-1,-1) ``` ```QGIS Expression array_slice(array('Dufour','Valmiera','Chugiak','Brighton'),1,2) ``` ```QGIS Expression array_slice(array('Dufour','Valmiera','Chugiak','Brighton'),-2,-1) ``` -------------------------------- ### Configuring QGIS Server with Environment Variables and spawn-fcgi Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/config.rst Set environment variables like QGIS_OPTIONS_PATH and QGIS_SERVER_LOG_STDERR before starting QGIS Server with spawn-fcgi. This example demonstrates setting log level and other options. ```bash export QGIS_OPTIONS_PATH=/home/user/.local/share/QGIS/QGIS4/profiles/default/ export QGIS_SERVER_LOG_STDERR=1 export QGIS_SERVER_LOG_LEVEL=2 spawn-fcgi -f /usr/lib/cgi-bin/qgis_mapserv.fcgi -s /tmp/qgisserver.sock -U www-data -G www-data -n ``` -------------------------------- ### Test HelloWorld plugin Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/plugins.rst Verify the server installation by sending a request to the HelloWorld service. ```bash wget -q -O - "http://localhost/cgi-bin/qgis_mapserv.fcgi?SERVICE=HELLO" ``` -------------------------------- ### Get Y Coordinate of Geometry Vertex (Deprecated) Source: https://github.com/qgis/qgis-documentation/blob/master/docs/user_manual/expressions/expression_help/GeometryGroup.rst Retrieves the y-coordinate of a vertex in the current feature's geometry. Vertex indices start at 0. This function is deprecated; use y_at() with @geometry instead. ```QGIS Expression $y_at(1) ``` -------------------------------- ### Enable Apache Modules and Site Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/getting_started.rst Enable the fcgid and rewrite Apache modules, and enable the QGIS Server virtual host site configuration. ```bash a2enmod fcgid a2enmod rewrite a2ensite qgis.demo ``` -------------------------------- ### Get X Coordinate of Vertex with $x_at (Deprecated) Source: https://github.com/qgis/qgis-documentation/blob/master/docs/user_manual/expressions/expression_help/GeometryGroup.rst Retrieves the x-coordinate of a specific vertex in the current feature's geometry. Vertex indices start at 0. This function is deprecated; use x_at() with @geometry instead. ```sql $x_at(1) ``` -------------------------------- ### Define PostgreSQL Connection Parameters Source: https://github.com/qgis/qgis-documentation/blob/master/docs/training_manual/spatial_databases/simple_feature_model.rst Example configuration values for setting up a new PostgreSQL connection in QGIS. ```text Name: myPG Service: Host: localhost Port: 5432 Database: address User: Password: ``` -------------------------------- ### Set Target Properties for Installation Source: https://github.com/qgis/qgis-documentation/blob/master/docs/developers_guide/unittesting.rst Configures installation properties for the test executable, including RPATH settings to ensure it can be found after installation. Handles platform-specific installation paths. ```bash SET_TARGET_PROPERTIES(qgis_${testname} PROPERTIES # skip the full RPATH for the build tree SKIP_BUILD_RPATHTRUE # when building, use the install RPATH already # (so it doesn't need to relink when installing) BUILD_WITH_INSTALL_RPATH TRUE # the RPATH to be used when installing INSTALL_RPATH ${QGIS_LIB_DIR} # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH INSTALL_RPATH_USE_LINK_PATH true) IF (APPLE) # For macOS, the executable must be at the root of the bundle's executable folder INSTALL(TARGETS qgis_${testname} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) ADD_TEST(qgis_${testname} ${CMAKE_INSTALL_PREFIX}/qgis_${testname}) ELSE (APPLE) INSTALL(TARGETS qgis_${testname} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) ADD_TEST(qgis_${testname} ${CMAKE_INSTALL_PREFIX}/bin/qgis_${testname}) ENDIF (APPLE) ``` -------------------------------- ### Install fcgiwrap Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/getting_started.rst Command to install the fcgiwrap package. ```bash apt install fcgiwrap ``` -------------------------------- ### MicroK8s Setup Commands Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/containerized_deployment.rst Commands to enable required MicroK8s features and push the QGIS Server image to the local registry. ```bash microk8s enable dashboard dns registry ``` ```bash docker tag qgis-server 127.0.0.1:32000/qgis-server && docker push 127.0.0.1:32000/qgis-server ``` -------------------------------- ### Install spawn-fcgi Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/getting_started.rst Command to install the spawn-fcgi package on Debian-based systems. ```bash apt install spawn-fcgi ``` -------------------------------- ### Set up Python Virtual Environment Source: https://github.com/qgis/qgis-documentation/blob/master/README.md Prepare the environment for managing dependencies by creating a virtual environment and activating it. This is a prerequisite for installing project requirements. ```sh python3 -m venv venv source ./venv/bin/activate pip install -r REQUIREMENTS.txt ``` -------------------------------- ### Buffer Algorithm Example Source: https://github.com/qgis/qgis-documentation/blob/master/docs/user_manual/processing/console.rst Example of running the 'native:buffer' algorithm with all its parameters. Ensure parameter values match their expected types (e.g., integer for END_CAP_STYLE, boolean for DISSOLVE). ```python >>> processing.run("native:buffer", {'INPUT': '/data/lines.shp', 'DISTANCE': 100.0, 'SEGMENTS': 10, 'DISSOLVE': True, 'END_CAP_STYLE': 0, 'JOIN_STYLE': 0, 'MITER_LIMIT': 10, 'OUTPUT': '/data/buffers.shp'}) ``` -------------------------------- ### Install Apache OSGeo4W Web Server Service Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/getting_started.rst Command to install the Apache web server as a Windows service using the OSGeo4W batch script. This is part of the QGIS Server installation on Windows. ```bash > apache-install.bat Installing the 'Apache OSGeo4W Web Server' service The 'Apache OSGeo4W Web Server' service is successfully installed. Testing httpd.conf.... Errors reported here must be corrected before the service can be started. ... ``` -------------------------------- ### Implement serverClassFactory Source: https://github.com/qgis/qgis-documentation/blob/master/docs/pyqgis_developer_cookbook/server.rst Entry point function required in __init__.py to load the plugin into QGIS Server. ```python def serverClassFactory(serverIface): from MyAccessControl.AccessControl import AccessControlServer return AccessControlServer(serverIface) ``` -------------------------------- ### Install GPSD on Ubuntu/Mint Source: https://github.com/qgis/qgis-documentation/blob/master/docs/user_manual/working_with_gps/live_GPS_tracking.rst Install the GPSD daemon to facilitate GPS device communication. ```bash sudo apt install gpsd ``` -------------------------------- ### Server Plugin Structure Example Source: https://github.com/qgis/qgis-documentation/blob/master/docs/pyqgis_developer_cookbook/server.rst Illustrates the basic structure of a QGIS server plugin, highlighting the availability of QgsServerInterface and methods for registering custom filters, services, or APIs. ```python # Server python plugins are loaded once when the QGIS Server application starts # and can be used to register filters, services or APIs. # The structure of a server plugin is very similar to their desktop counterpart, a :class:`QgsServerInterface ` object is made available to # the plugins and the plugins can register one or more custom filters, services or APIs # to the corresponding registry by using one of the methods exposed by the server interface. ``` -------------------------------- ### QGIS Server Environment Variables Example Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/getting_started.rst Example configuration for QGIS Server environment variables, specifying project file, logging output, and log level. ```make QGIS_PROJECT_FILE=/etc/qgis/myproject.qgs QGIS_SERVER_LOG_STDERR=1 QGIS_SERVER_LOG_LEVEL=3 ``` -------------------------------- ### WMTS Service URL Example Source: https://github.com/qgis/qgis-documentation/blob/master/docs/user_manual/working_with_ogc/ogc_client_support.rst Example URL for accessing a WMTS GetCapabilities request. ```text # example of WMTS service https://opencache.statkart.no/gatekeeper/gk/gk.open_wmts?service=WMTS&request=GetCapabilities ``` -------------------------------- ### Show QgsAuthConfigSelect GUI Source: https://github.com/qgis/qgis-documentation/blob/master/docs/pyqgis_developer_cookbook/authentication.rst Demonstrates the basic instantiation and display of the QgsAuthConfigSelect GUI. Ensure the parent widget is properly set up. ```python parent = QWidget() # Your GUI parent widget gui = QgsAuthConfigSelect( parent ) gui.show() ``` -------------------------------- ### Configure Eclipse startup batch file Source: https://github.com/qgis/qgis-documentation/blob/master/docs/pyqgis_developer_cookbook/plugins/ide_debugging.rst Create a script to initialize the OSGeo4W environment and launch Eclipse with the necessary path variables. ```bat call "C:\OSGeo4W\bin\o4w_env.bat" set PATH=%PATH%;C:\path\to\your\qgis_core.dll\parent\folder start /B C:\path\to\your\eclipse.exe ``` -------------------------------- ### Delimited Text File with WKT Geometry Examples Source: https://github.com/qgis/qgis-documentation/blob/master/docs/user_manual/managing_data_source/supported_data.rst This example demonstrates how to store geometry information in a delimited text file using Well-Known Text (WKT) format. It includes examples for LineString, CircularString, CurvePolygon, and CompoundCurve. ```text Label;WKT_geom LineString;LINESTRING(10.0 20.0, 11.0 21.0, 13.0 25.5) CircularString;CIRCULARSTRING(268 415,227 505,227 406) CurvePolygon;CURVEPOLYGON(CIRCULARSTRING(1 3, 3 5, 4 7, 7 3, 1 3)) CompoundCurve;COMPOUNDCURVE((5 3, 5 13), CIRCULARSTRING(5 13, 7 15, 9 13), (9 13, 9 3), CIRCULARSTRING(9 3, 7 1, 5 3)) ``` -------------------------------- ### QGIS Server Output Examples Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/getting_started.rst Expected output logs when running the QGIS server binary. ```text QFSFileEngine::open: No file name specified Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable. Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable. Warning 1: Unable to find driver JP2ECW to unload from GDAL_SKIP environment variable. Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable. Warning 1: Unable to find driver JP2ECW to unload from GDAL_SKIP environment variable. Content-Length: 206 Content-Type: text/xml; charset=utf-8 Service unknown or unsupported ``` ```text Application path not initialized Application path not initialized Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable. Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable. Warning 1: Unable to find driver JP2ECW to unload from GDAL_SKIP environment variable. "Loading native module /usr/lib/qgis/server/libdummy.so" "Loading native module /usr/lib/qgis/server/liblandingpage.so" "Loading native module /usr/lib/qgis/server/libwcs.so" "Loading native module /usr/lib/qgis/server/libwfs.so" "Loading native module /usr/lib/qgis/server/libwfs3.so" "Loading native module /usr/lib/qgis/server/libwms.so" "Loading native module /usr/lib/qgis/server/libwmts.so" QFSFileEngine::open: No file name specified Content-Length: 102 Content-Type: application/json Server: QGIS FCGI server - QGIS version 3.22.6-Białowieża Status: 400 [{"code":"Bad request error","description":"Requested URI does not match any registered API handler"}] ``` -------------------------------- ### Initialize Authentication Manager and Master Password Source: https://github.com/qgis/qgis-documentation/blob/master/docs/pyqgis_developer_cookbook/authentication.rst Demonstrates how to verify or set the master password for the authentication database. ```python authMgr = QgsApplication.authManager() # check if QgsAuthManager has already been initialized... a side effect # of the QgsAuthManager.init() is that AuthDbPath is set. # QgsAuthManager.init() is executed during QGIS application init and hence # you do not normally need to call it directly. if authMgr.authenticationDatabasePath(): # already initialized => we are inside a QGIS app. if authMgr.masterPasswordIsSet(): msg = 'Authentication master password not recognized' assert authMgr.masterPasswordSame("your master password"), msg else: msg = 'Master password could not be set' # The verify parameter checks if the hash of the password was # already saved in the authentication db assert authMgr.setMasterPassword("your master password", verify=True), msg else: ``` -------------------------------- ### Example Code Block Source: https://github.com/qgis/qgis-documentation/blob/master/docs/about/conventions.rst Lines of code are indicated by a fixed-width font. This example shows a PROJCS definition. ```plaintext PROJCS["NAD_1927_Albers", GEOGCS["GCS_North_American_1927", ``` -------------------------------- ### QGIS Development Server Example Output Source: https://github.com/qgis/qgis-documentation/blob/master/docs/server_manual/development_server.rst Example output from the QGIS Development Server showing connection logs and served requests. It indicates the listening address and port. ```bash QGIS Development Server listening on http://localhost:8000 CTRL+C to exit 127.0.0.1 [lun gen 20 15:16:41 2020] 5140 103ms "GET /wfs3/?MAP=/tests/testdata/qgis_server/test_project.qgs HTTP/1.1" 200 127.0.0.1 [lun gen 20 15:16:41 2020] 3298 2ms "GET /wfs3/static/jsonFormatter.min.js HTTP/1.1" 200 127.0.0.1 [lun gen 20 15:16:41 2020] 1678 3ms "GET /wfs3/static/jsonFormatter.min.css HTTP/1.1" 200 127.0.0.1 [lun gen 20 15:16:41 2020] 1310 5ms "GET /wfs3/static/style.css HTTP/1.1" 200 127.0.0.1 [lun gen 20 15:16:43 2020] 4285 13ms "GET /wfs3/collections?MAP=/tests/testdata/qgis_server/test_project.qgs HTTP/1.1" 200 ``` -------------------------------- ### Verify QGIS Server installation Source: https://github.com/qgis/qgis-documentation/blob/master/docs/training_manual/qgis_server/install.rst Check the version information of the QGIS Server executable to confirm successful installation. ```bash /usr/lib/cgi-bin/qgis_mapserv.fcgi --version ``` -------------------------------- ### Install pgAdmin III on Ubuntu Source: https://github.com/qgis/qgis-documentation/blob/master/docs/training_manual/database_concepts/data_model.rst Installs the pgAdmin III GUI tool using the apt package manager. ```bash sudo apt install pgadmin3 ``` -------------------------------- ### Execute QGIS from build directory Source: https://github.com/qgis/qgis-documentation/blob/master/docs/developers_guide/qtcreator.rst Commands to navigate to the build directory and launch the QGIS executable. ```bash cd $HOME/dev/cpp/QGIS/build-master-qtcreator ./output/bin/qgis ``` -------------------------------- ### QGIS Test Definition Example Source: https://github.com/qgis/qgis-documentation/blob/master/docs/developers_guide/unittesting.rst Example of how to define a QGIS test using the ADD_QGIS_TEST macro in a CMakeLists.txt file. ```cmake # QgsRasterLayer test ADD_QGIS_TEST(rasterlayertest testqgsrasterlayer.cpp) ``` -------------------------------- ### Python Code Block Example Source: https://github.com/qgis/qgis-documentation/blob/master/docs/documentation_guidelines/cookbook_guidelines.rst This is an example of a standard Python code block, typically used for syntax highlighting. ```python crs = QgsCoordinateReferenceSystem("EPSG:4326") assert crs.isValid() ``` -------------------------------- ### Example .pg_service.conf Structure Source: https://github.com/qgis/qgis-documentation/blob/master/docs/user_manual/managing_data_source/opening_data.rst Defines connection parameters for different PostgreSQL services. Save this content in a file named .pg_service.conf on Unix-like systems or pg_service.conf on Windows. ```ini [water_service] host=192.168.0.45 port=5433 dbname=gisdb user=paul password=paulspass [wastewater_service] host=dbserver.com dbname=water user=waterpass ``` -------------------------------- ### QGIS Plugin .pro File Example Source: https://github.com/qgis/qgis-documentation/blob/master/docs/pyqgis_developer_cookbook/plugins/plugins.rst A sample .pro file for a QGIS plugin, specifying UI forms, source files, and translation files for Qt Linguist. ```pro FORMS = ../form.ui SOURCES = ../your_plugin.py TRANSLATIONS = your_plugin_it.ts ``` -------------------------------- ### Install PostGIS on Ubuntu Source: https://github.com/qgis/qgis-documentation/blob/master/docs/training_manual/spatial_databases/spatial_functions.rst Installs PostgreSQL and PostGIS using apt. The exact versions depend on your Ubuntu version and repositories. ```bash $ sudo apt install postgresql $ sudo apt install postgis ``` -------------------------------- ### Run QGIS with a New User Profile Source: https://github.com/qgis/qgis-documentation/blob/master/docs/user_manual/introduction/qgis_configuration.rst Use this command to start QGIS with a specific, new user profile. This is useful for testing or isolating settings. ```bash qgis-ltr --profile newprofilename ```