Tag: qgis

FOSS4G Auckland 2025: Tech Trends and People - QGIS LAB by MIERUNE

Introduction Hello, everyone. I’m Yamazaki, an Engineering Manager at MIERUNE. Lately (in 2025), FOSS4G events have been very active in regions across Japan. This fiscal year, a total of five FOSS4G e...
Learn More

[Blog] Share maps via URL: now in early access

Share Mergin Maps projects easily with a public URL. Give anyone access to your map without an account and showcase collected data in seconds.
Learn More

Counting Hokkaido's Traffic Signals with QGIS - QGIS LAB by MIERUNE

Introduction Traffic signals are a familiar sight, but have you ever wondered how many are installed in your own municipality? For many people, signals are simply part of the scenery, and their number...
Learn More

How to Dissolve Polygons by Attribute in QGIS - QGIS LAB by MIERUNE

Introduction QGIS has a feature called dissolve, which merges adjacent polygons or lines that share an attribute . It is useful for aggregating and restructuring data, such as combining municipality d...
Learn More

[Blog] How to collect GPS points for QGIS on Android with Mergin Maps

Easily collect GPS data on your Android device with Mergin Maps. This powerful and user-friendly app integrates seamlessly with QGIS for efficient mobile data collection, syncing and collaboration even when offline.
Learn More

Partagez vos modèles QGIS facilement !

Découvrez 5 façons de partager vos modèles QGIS : de l'avion à l’intégration dans un plugin !
Learn More

QGIS to (Geo)Pandas – part 3

The journey continues: QgsArrowIterator is now merged! This makes it possible to iterate over QgsFeatures as Arrow batches.

This is where we are now, quoting Dewey Dunnington:

import geopandas
from nanoarrow.c_array import allocate_c_array
import qgis
from qgis.core import QgsVectorLayer

# Create a vector layer
layer = QgsVectorLayer("tests/testdata/zonalstatistics/polys.shp", "layer_name", "ogr")
schema = qgis.core.QgsArrowIterator.inferSchema(layer)

it = qgis.core.QgsArrowIterator(layer.getFeatures())
it.setSchema(schema, 1)

c_array = allocate_c_array()
schema.exportToAddress(c_array.schema._addr())
it.nextFeatures(5, c_array._addr())

print(geopandas.GeoDataFrame.from_arrow(c_array))
#> lev3_name                                           geometry
#> 0    poly_1  MULTIPOLYGON (((100.37934 -0.96049, 100.37934 ...
#> 1    poly_2  MULTIPOLYGON (((100.37944 -0.96044, 100.37955 ...
#> 2    poly_3  MULTIPOLYGON (((100.37938 -0.96049, 100.37949 ...

print(geopandas.read_file("tests/testdata/zonalstatistics/polys.shp"))
#> lev3_name                                           geometry
#> 0    poly_1  POLYGON ((100.37934 -0.96049, 100.37934 -0.960...
#> 1    poly_2  POLYGON ((100.37944 -0.96044, 100.37955 -0.960...
#> 2    poly_3  POLYGON ((100.37938 -0.96049, 100.37949 -0.960...

Further improvements are already being planned. To quote from the ticket:

“The final state after this improvement would be a compact way for Arrow Python consumers like GeoPandas to ergonomically consume a layer. Maybe:

geopandas.GeoDataFrame.from_arrow(qgis_layer_object)

Or maybe:

geopandas.GeoDataFrame.from_arrow(qgis_layer_object.getArrowStream())

Looking forward to seeing this develop further.

Learn More

How Long to the Airport? Drive Time in QGIS - QGIS LAB by MIERUNE

Introduction The author lives in Hokkaido and one day wondered: “Where in Hokkaido is farthest from an airport?” Is it the midpoint between Wakkanai Airport and Asahikawa Airport in northern Hokkaido,...
Learn More

[Blog] How to use Mergin Maps to collaborate on QGIS projects

Learn how to collaborate on QGIS projects using Mergin Maps. Discover sync workflows, user roles, mobile & desktop collaboration scenarios, and how to streamline field data collection with reliable versioning and cloud integration.
Learn More

New in QGIS 3.40 : CMYK Support

Credits : Bru-nO (Pixabay Content License)

Thanks to funding from the Bordeaux Metropolis, I had the chance to work on CMYK (Cyan Magenta Yellow blacK) support in QGIS. The metropolis’ goal is to remove the last barrier preventing their complete migration from ArcGIS to QGIS.

The developments are now complete and will be available in QGIS version 3.40, scheduled for release in October 2024, before becoming the next LTR in February 2025. It should be noted, however, that CMYK support will only be complete in QGIS versions built with Qt 6 (still unofficial version) for reasons explained in the article. On Windows, this version can currently only be installed using OSGeo4W (qgis-qt6-dev version).

EDIT: Actually, QGIS version built with Qt 6.8, which ships the needed modifications for CMYK PDF export, is not yet released. More information here.

What is CMYK?

You probably know RGB, which allows you to code a color on screen by choosing the amount of red, green and blue in that color. You may also use TSL or TSV.

RVB – Credits : Daniel Roberts (Pixabay Content License)

These 3 color references allow a color to be coded for a screen, while CMYK targets printers by allowing to set the exact quantity of ink that will be released during printing (hence the 4 CMYK components, one per ink cartridge).

 

CMYK ( here from left to right KCMY ) – Credits : Magnascan (Pixabay Content License)

The characteristics of CMYK differ greatly from RGB, it’s considered a subtractive colorimetric mode, because the ink absorbs light unlike RGB which is said to be additive, the more red, green, blue you have the closer you are to full light, white.

The intrinsically different nature of these 2 color spaces means that it is strongly advised not to convert from one to the other. The best is to choose a color in a space (CMYK for printing, RGB for rendering on screen) and stick to it.

Worse, printing the same color is different depending on the printer, ink, paper… The choice of a CMYK color has to be done in a color space, represented by a ICC profile file, provided by your printer. It is a bit like a color chart used when choosing paint.

 

Now you can argue about the REALLY good color of a road line – Credits : Yanis Ladjouzi (Pixabay Content License)

Developments in QGIS… and Qt

It is now possible in QGIS to:

  • Enter colors in CMYK format, and in floating precision;
  • Define your preferred color mode (RGB or CMYK) and your color space;
  • Generate a file in PDF/X-4 format (ready for printing) embedding a color space and using CMYK colors;
  • Allow the expression engine to manipulate CMYK colors without converting them to RGB;
  • Manage CMYK color ramps;
  • Lots of other small improvements and corrections about color management.

 

Selecting colors in QGIS in CMYK

The beautiful story of Open source

I took great pleasure in participating in this development because it is the result of the collaboration of many players in free software.

During a first phase of study concerning the support of CMYK in QGIS, we quickly identified that Qt, the framework used by QGIS for rendering maps, has limitations. It converts all colors to RGB when rendering maps in PDF format and its support for CMYK color spaces is incomplete.

It is therefore necessary to make it evolve. We therefore turn to our preferred partner when it comes to Qt, KDAB, and more precisely Giuseppe D’Angelo who then carries out the necessary developments.

Regarding new features, these are only available in Qt 6 (Qt 5 is end of life). This is why CMYK support is incomplete in official versions of QGIS still based on Qt 5.

QGIS.org, the association that oversees the QGIS project, decided to fund the developments on Qt. Oslandia, on the other hand would have to manage these developments and then to carry out the integration in QGIS. This integration as well as the related new features was funded by the Bordeaux metropolis.

My developments were then reviewed by other QGIS contributors. (If you want to know more about the QGIS contribution process, you can read a previous blog post about software quality in QGIS)

Finally, I wanted to give a special thanks to Jehan, developer on the GIMP project. His availability and thoroughness in our mail exchanges greatly helped me understand the technical and functional issues of CMYK, and most certainly contributed to the quality of the result.

Next

QGIS 3.40 will therefore be able to generate a PDF/X-4 file using CMYK colors. Qt, for its part, improves CMYK support, PDF writing, and color space management.

Thanks again to the Bordeaux metropolis and QGIS.org for funding these developments, and all the people involved in their realization.

We would be delighted to have feedback from users on your use cases related to color management in QGIS. Do not hesitate to write to us or comment on our posts to tell us how you use these features.

These foundations in the management of color spaces in QGIS open the door to future improvements. If you are interested in this topic and would like to contribute, please contact us at infos+qgis@oslandia.com and check out our QGIS support offer.

Learn More