Mapnik 4.0.3 Release Oct 30, 2024 | Artem Pavlenko
Mapnik 4.0.2 Release Aug 21, 2024 | Artem Pavlenko
Mapnik 4.0.1 Release Jul 30, 2024 | Artem Pavlenko
Mapnik 4.0.0 Release Jun 16, 2024 | Artem Pavlenko
Mapnik 3.1.0 Release Jan 08, 2021 | Artem Pavlenko
Mapnik 3.0.24 Release Jan 05, 2021 | Artem Pavlenko
Mapnik 3.0.23 Release Jan 18, 2020 | Artem Pavlenko
Mapnik 3.0.22 Release Jan 22, 2019 | Artem Pavlenko
Mapnik 3.0.21 Release Oct 08, 2018 | Artem Pavlenko
Mapnik 3.0.20 Release Apr 12, 2018 | Artem Pavlenko
Mapnik 3.0.19 Release Mar 06, 2018 | Artem Pavlenko
Mapnik 3.0.18 Release Jan 26, 2018 | Artem Pavlenko

latest news

Improving Text Rendering

May 28, 2011

My Summer of Code project this year is about improving Mapnik's text rendering. There are two problems with the way text is currently rendered. I'll describe these problems and show how I intend to solve them.

Dynamic placement

When rendering crowded areas there is often no space to place a label at the point it should go to and the label therefore is dropped.


View Larger Map

In the example above many symbols are missing a label because there was no space, but they could have been shown when moved a bit. I already worked on this problem this winter and now you can tell Mapnik 2 to try different locations and font sizes. But the algorithm is quite limited at the moment and many important properties can't be changed. So the first part of my work is to add these missing features. The most important change will be that one is able to change the text. So if rendering "Example Street" fails, it could try "Example St.".

Improved formatting

The other big problem is that Mapnik doesn't have any means to change formatting in a TextSymbolizer. When you try to label a mountain peak with name and elevation like this

Name
Elevation

you need two symbolizers, one for the name and one for the elevation and calculate a appropriate offset for the second one. But if the name is a bit longer and mapnik splits it into multiple lines this calculation is wrong, the texts overlap and mapnik drops one.

My project is to add formating capabilities to TextSymbolizers. When I'm done one will only need one symbolizer for this job and the positions will adjust automatically.

Copyright © 2024 Artem Pavlenko | Downloads | License | Media | Developer