[OSM-dev] [Tile-serving] parameterization of mapnik style-sheets in mod_tile / renderd and multi-lingual maps
kakrueger at gmail.com
Mon Oct 14 18:16:40 UTC 2013
On 10/14/2013 11:59 AM, Lynn W. Deffenbaugh (Mr) wrote:
> Could this feature be used to pass a font-scaling value from the URL to
> mod_tile assuming that such a scaling value can be used to affect the
> font sizes rendered in the resulting tile? I'm thinking like
> .../style/2/z/x/... for instance to double the size of the fonts. This
> would be very handy to provide for rendering tiles for higher-dpi
> devices and keeping them readable.
Yes, it should be possible. All you need to do is write a function that
takes a mapnik::Map object and a parameterization string and returns a
transformed mapnik:Map object. As the font size is presumably specified
in the style-sheet you should be able to do that with little problem.
You can find the example for the multi-lingual parameterization in
Note: for different resolution tiles, you can already change that in
mod_tile / renderd with a simple parameter in the renderd.conf (
TILESIZE=512 ), but that is only on a style-by-style basis and not a
> Also, are the resulting rendered meta-tiles automatically segregated in
> the mapnik/apache file store? I sure hope so or there'll be a serious
> mess of mixed-rendered tiles all under a tree like "default".
Yes, they are segregated, at least in the file storage backend. I
haven't yet updated the rados / ceph storage backend, but I'll fix that
soon and I am not sure anyone is actually using that backend.
For the filesystem storage backend, it uses the following schema to
i.e. the parameterisation string is part of the metatile filename and
all different parameterisations live in the same sub directory.
Putting the parameterisation into the filename, rather than as its own
subdirectory, should make it easier to expire and delete files, as all
files for one (geographic) tile are in the same directory.
> Lynn (D) - KJ4ERJ - Author of APRSISCE for Windows Mobile and Win32
> On 10/14/2013 12:40 PM, Kai Krueger wrote:
>> Hello everyone,
>> I would like to mention that I have committed a new feature to mod_tile
>> / renderd and would appreciate any feedback or comments.
>> Mod_tile and renderd are now prepared for the possibility to
>> parameterize the mapnik style-sheet on the fly on a (meta)tile by
>> (metatile) basis.
>> For this purpose, the URL schema for tileservers was extended. It now
>> takes the form:
>> parameters is an arbitrary string that gets passed on to renderd and can
>> be used to parameterize the style-sheet for that rendering request.
>> The first use for this functionality is to make it easy to offer
>> multi-lingual maps. I.e. to be able to specify (parameterize) the
>> language in which the names should appear on the map. E.g. one can
>> specify that English names (name:en) should be used instead of the plain
>> name tag.
>> This is heavily based upon Jochen Topf's work on the multi-lingual
>> project for wikimedia [1,2], that has shown the feasibility of this
>> concept. By integrating it into mod_tile / renderd and making it trivial
>> to enable, it will hopefully see wider adoption and prove useful to a
>> bigger audience.
>> You can specify an ordering of name tags to be used when trying to
>> render any labels. E.g. de,en,_ will use name:de if available, otherwise
>> try name:en and finally use name if neither name:de or name:en is
>> available. Technically, renderd will take the stylesheet it loads and
>> replace name in the sql queries with coalesce(tags->'name:de',
>> tags->'name:en', tags->'name') as name.
>> Everything should be backwards compatible and one can activate this
>> feature on a style-by-style basis. If not activated, the old URL schema
>> continues to be used.
>> So e.g. a server can support https://my.tile.server/osm/0/0/0.png and
>> To make this possible, the protocol between mod_tile and renderd was
>> extended to include the parameterization string (as well as pass through
>> mime information for future purposes, e.g. to be able to render both png
>> and jpg). However, again, everything (both mod_tile and renderd) should
>> be backwards compatible. I.e. renderd can receive rendering requests
>> with the previous version of the protocol, in case you only want to
>> update renderd and still have an older version of mod_tile (or indeed
>> another server software or utility for issuing render requests).
>> Likewise, mod_tile can still send the requests in the previous protocol,
>> and indeed will do so by default unless the parameterization feature is
>> explicitly activated for the given style. This should ensure
>> compatibility with tirex, that has not yet been updated to the change in
>> Although its first use is for the multi-lingual maps, hopefully this
>> feature can be used for other purposes as well. You still need to write
>> code to interpret the parameterization string and apply the
>> transformation to the mapnik stylesheet object, but given that is all
>> encapsulated in a separate file, this will hopefully be relatively easy
>> if one needs it.
>> dev mailing list
>> dev at openstreetmap.org
> Tile-serving mailing list
> Tile-serving at openstreetmap.org
More information about the dev