Accueil / Blog / Métier / Archives / landez : tiles post-processing

landez : tiles post-processing

Par Mathieu Leplatre 29/05/2012

Some weeks ago, I started to refactor landez (timidly). But smart caching and post-processing of WMS maps were expected in my last project, so it gave me a great boost : Landez 2.0 has landed ! :)

The base code is much clearer, and a few new features came out ! Among them, the ability to apply image filters to your maps !

Grayscale conversion

Not the funniest one of course, but quite handy to highlight map content !

from landez import MBTilesBuilder
from landez.filters import GrayScale

overlay = MBTilesBuilder()

Color to Alpha

If the tiles you overlay are mainly white, they might make your background layer brighter. Therefore, adding a filter replacing white by transparent will nicely blend your top layer without lightening the global result :

from landez import TilesManager, ImageExporter
from landez.filters import ColorToAlpha

overlay = TilesManager(tiles_url='{z}/{x}/{y}.png')

orthophoto = ImageExporter(wms_server='http://server/wms',

Continuous Integration

A Travis job was setup and allows me to improve the testing strictness :)

The Travis configuration has some kind of magic, just drop one file and enable the hook in your Github repo :

language: python
  - 2.6
  - 2.7
  - pip install Pillow
  - python develop
script:  python -m landez.tests

Next steps...

I hope to get the opportunity to develop new post-processing filters, as pretty as those coming-up in MapBox Tilemill !

PerryGeo wrote python-mbtiles which might be a good candidate for low-level access of MBTiles content. I like the idea of a common python stack for reading and writing, it is not very clear to me which one will emerge as the best one though...