• Stars
    star
    423
  • Rank 98,603 (Top 3 %)
  • Language
    Python
  • Created about 11 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

QGIS Documentation

Our full logo

Docs Builds Doctest Build Read the documentation

This repository is meant to write and manage the Official Documentation of QGIS, a free and Open Source Geographic Information System (GIS) Software, under the Open Source Geospatial (OSGeo) foundation umbrella.

The latest documentation is available at https://docs.qgis.org/latest

Building the documentation

  1. If not provided by your OS, you need to install:

    You can install both in default places and with default options.

  2. Clone the repository

  3. Go into that directory and follow the next instructions depending on your OS.

The best way to build the documentation is within a Python Virtual Environment (venv).

Build on Linux

To check/create the venv and use it in the build:

make -f venv.mk html

The venv.mk will create/update a virtual env (if not available) in current dir/venv AND run the html build in it.

You can also use that virtual environment later doing:

source venv/bin/activate

to activate the venv and then run the build from within that venv:

make html

If, for some reason, you want to start from scratch:

make -f venv.mk cleanall

Build on macOS or Linux

You can also use your own virtual env by creating it first:

# you NEED python >3.6. Depending on distro either use `python3` or `python`
# common name is 'venv' but call it whatever you like

python3 -m venv venv  # using the venv module, create a venv named 'venv'

Then activate the venv:

source ./venv/bin/activate

With 'activated' virtualenv, you should see 'venv' in the prompt. Install the requirements via the REQUIREMENTS.txt:

pip install -r REQUIREMENTS.txt

And run the build from within that venv:

make html

Want to build your own language? Note that you will use the translations from the po files from git! For example for 'nl' do:

make LANG=nl html

Build on Windows

Create a virtual environment called 'venv' in that directory (search the Internet for Python Virtual Env on Windows for more details), but in short: use the module 'venv' to create a virtual environment called 'venv'

# in dos box:
python -m venv venv

Then activate the venv:

venv\Scripts\activate.bat

With 'activated' virtualenv, you should see 'venv' in the prompt. Install the requirements via the REQUIREMENTS.txt:

pip install -r REQUIREMENTS.txt

And run the build from within that venv, using the make.bat script with the html argument to locally build the docs:

make.bat html

Want to build your own language? Note that you will use the translations from the po files from git! For example 'nl' do:

set SPHINXOPTS=-D language=nl
make.bat html

Build PDFs

In Linux, you can also build the PDF versions of the main documents.

make -f venv.mk pdf

Or after you enabled the venv:

make pdf

If you want to build PDFs in a language other than English, you can use a similar syntax:

make LANG=fr pdf

For building PDFs in English you will need to install the XeLaTex compiler package texlive-xetex and GNU Freefont.

sudo apt install texlive-xetex fonts-freefont-otf

For building translated PDFs, you may have to install the texlive extra package for your specific language (e.g. texlive-lang-french). For japanese, it's crucial to install texlive-lang-japanese, which will install the platex compiler. If you plan to build all languages, it might be easier to install all languages packages (texlive-lang-all), but it will use a considerable amount of disk space.

Some languages will also need specific fonts installed:

  • Korea (ko) - NanumMyeongjo from the fonts-nanum package
  • Hindi (hi) - Nakula from the fonts-nakula package

Translating

We rely on the Transifex platform to store and coordinate our translation efforts. To be part of the translation team, please follow becoming a translator.

The process is automated using the Transifex - GitHub integration system and some custom scripts:

  • The transifex.yml configuration file: provides way to retrieve the English source files and where to locate the translated ones.


    Note to Transifex administrators

    If after the integration system is setup for a new release, the translation strings fail to (fully) upload to Transifex:

    1. Run the create_transifex_resources script: creates/updates the .tx/config file with formatted references of the English source files and their translation in the GitHub repository and link them to the resources in Transifex.
    2. Force-push the translation files to Transifex
       tx push -f -t --no-interactive
      

  • The transifex integration bot: manages pulls and pushes of the strings, in other words:

    • Tracks any changes of the English *.po resource files in GitHub and automatically sends them to the Transifex platform
    • When a resource is 100% translated, automatically sends back the translated *.po file to GitHub, for build.
  • The pofiles action: creates/updates English *.po files with recent changes in the source *.rst files. Feeds the transifex bot.

  • For files that are not yet fully translated in Transifex, the pull_minimized_translations action periodically and automatically pulls them to the repository.

Based on the above, translated strings are automatically available in released branch so building the docs in any translated locale is possible following the instructions in earlier sections:

make html LANG=yourlanguage

Sometimes, you may want to build the docs with really new strings in a partially translated file and the above workflow may fail to work. In that case, you need to manually pull the translations from Transifex to your local repository:

  1. Checkout locally the repository and target branch in git

  2. Prepare the environment

    python3 -m venv venv
    source ./venv/bin/activate
    pip install -r REQUIREMENTS.txt
    
  3. Install Transifex command line client

    curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
    
  4. Download the translated strings using the minimize_translation script. By default this pulls all the languages.

    ./scripts/minimize_translation.sh
    

    To pull a specific language (e.g. italian), do

    ./scripts/minimize_translation.sh -l it
    

    IMPORTANT: to be able to pull from transifex.com, you will need a credentials file. This file should be named: .transifexrc and easiest is to put it in your home dir. The file should contain this:

    [https://app.transifex.com]
    rest_hostname = https://rest.api.transifex.com
    token = yourtransifextoken
    
  5. Build the docs in your language

    make html LANG=yourlanguage
    
  6. Share the changes by opening a pull-request, allowing us to integrate the new strings for the pulled language(s)

Testing Python snippets

To test Python code snippets in the PyQGIS Cookbook, you need a QGIS installation. For this there are many options:

  • You can use your system QGIS installation with Sphinx from Python virtual environment:

    make -f venv.mk doctest
    
  • You can use a manually built installation of QGIS. To do so, you need to:

    1. Create a custom Makefile extension on top of the venv.mk file, for example a user.mk file with the following content:

      # Root installation folder
      QGIS_PREFIX_PATH = /home/user/apps/qgis-master
      
      # Or build output folder
      QGIS_PREFIX_PATH = /home/user/dev/QGIS-build-master/output
      
      include venv.mk
      
    2. Then use it to run target doctest:

      make -f user.mk doctest
      
  • Or you can run target doctest inside the official QGIS docker image:

    make -f docker.mk doctest
    

Note that only code blocks with directive testcode are tested and it is possible to run tests setup code which does not appear in documentation with directive testsetup, for example:

 .. testsetup::

     from qgis.core import QgsCoordinateReferenceSystem

 .. testcode::

     # SRID 4326 is allocated for WGS84
     crs = QgsCoordinateReferenceSystem("EPSG:4326")
     assert crs.isValid()

For more information see Sphinx doctest extension documentation: https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html

More Repositories

1

QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
C++
9,434
star
2

qwc2-demo-app

QWC2 demo application
JavaScript
194
star
3

qwc2

QGIS Web Client 2 Components
JavaScript
159
star
4

QGIS-Web-Client

A web client for the QGIS Server project
JavaScript
148
star
5

qgis-js

QGIS core ported to WebAssembly to run it on the web platform
TypeScript
136
star
6

QGIS-Website

QGIS-Website
POV-Ray SDL
123
star
7

QGIS-Enhancement-Proposals

QEP's (QGIS Enhancement Proposals) are used in the process of creating and discussing new enhancements for QGIS
110
star
8

QGIS-Processing

Example scripts, algorithms etc
Python
93
star
9

QGIS-Code-Examples

Examples as part of a tutorial series in C++
C++
91
star
10

QGIS-Android

The official repository for the QGIS port to Android
Java
90
star
11

QGIS-Django

Django project for QGIS related activities such as plugin repository
Python
85
star
12

pyqgis

Sphinx project to build python API documentation for QGIS
Python
80
star
13

QGIS-Mac-Packager

Scripts for Official QGIS MacOS Packages
Shell
50
star
14

QGIS-Training-Data

Data for QGIS Training Manual exercises
QML
44
star
15

homebrew-qgisdev

Homebrew recipes for QGIS and MacOS
Shell
39
star
16

QGIS-Resources

R
27
star
17

QGIS-Hugo

Hugo static website for the new QGIS.org
Sass
15
star
18

QGIS-workshop-old

QGIS Python Workshop From FOSS4G2012 in Denver
Python
12
star
19

pyqgis_wrappers

common functions to be used in pyqgis and python qgis plugins
Python
11
star
20

QGIS-Server-PerfSuite

QGIS Server Performance test suite
HTML
8
star
21

QGIS-Sysadmin

General repo for system related admin scripts (docker, apache etc etc). Also to be used for issues regarding general System Administration issues.
Python
8
star
22

QGIS-Sample-Data

Repo for QGIS Sample data (aka Alaska dataset), used in QGIS Documentation
Shell
7
star
23

QGIS-Promotion

Press and print material for promoting QGIS
6
star
24

demo.qgis.org

Demo site for QGIS
JavaScript
4
star
25

QGIS-Redmine-Hub

Redmine plugin for hub.qgis.org customization
Ruby
4
star
26

qgis4.0_api

Tracker for QGIS 4.0 API related issues and developer discussion
3
star
27

QGIS-Compilation-Guide

Latex sources for QGIS Compilation Guide
TeX
3
star
28

QGIS-Hub-Plugin

A QGIS plugins to fetch resources from the QGIS Hub
Python
3
star
29

QGIS-Stripe

QGIS website - Stripe integration
HTML
2
star
30

PSC

2
star
31

QGIS-Server-CertifSuite

Automated test suite to run teamEngine OGC tests against QGIS server
Python
2
star
32

donate.qgis.org

Static donations page for QGIS.ORG with cookie advisory
HTML
2
star
33

libdxfrw

C
1
star
34

doc-test

Tests for documentation
Python
1
star
35

marketing

1
star
36

qgis3_UIX_discussion

Issue list to sum up and discuss UI/UX related issues
1
star
37

api.qgis.org

This is a GitHub pages project for hosting API docs
1
star
38

Grant-proposals

Repository to be used for the submission of Grant proposals
1
star
39

QGIS-Presentations

List of presentations (or presentation links) shared by the QGIS community
1
star