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

Latest from mapnik development team

Feb 10, 2012

Text placement re-factoring

Big merge this week : both text-placement (Herm) and feature_impl branches got pushed to the mapnik/master.

One of the goals for “text-placement” was to re-factor rather messy text placement code into more manageable chunks, and hopefully to make it easier to follow and implement new features. So, now we have a better framework for text labeling - let’s use it. A classic example is labeling multipolygons that make up one geographical entity; country, county or state etc. Here are some maps to demonstrate how this would work for the US states :

1) Labeling regression (actually it never worked properly but changes to how multi-geometry is processed in Mapnik exposed this):

regression

2) Try and label every polygon:

all polygons

3) Order polygons by “size” and place label in first largest polygon:

largest-only

[3] is now current default behaviour in master, giving a much better cartographic result. We need to expose other possible options in XML/Python/Node etc.

Feature concept changes

New ‘context’ based feature implementation landed in Mapnik. The interface was preserved as much as possible to make it easier to update existing code: the following Python code shows the differences with the new approach:

>>> import mapnik
>>> ctx = mapnik.Context() # create Feature context
>>> ctx.push("NAME") # push some names, defining a schema 
>>> f = mapnik.Feature(ctx, 1) # create feature by passing context and ID
>>> f["NAME"] = "test"

The main gain here is a memory footprint and faster feature construction - no overhead of maintaining std::map per feature. Looking to the future, it will be interesting to see how we can leverage this for more robust/compact interchange formats.

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