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()
overlay.add_filter(GrayScale())

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='http://an.osm.mirror.org/{z}/{x}/{y}.png')
overlay.add_filter(ColorToAlpha('#ffffff'))

orthophoto = ImageExporter(wms_server='http://server/wms',
                           wms_layers=['orthophoto'])
orthophoto.add_layer(overlay)

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
python:
  - 2.6
  - 2.7
install:
  - pip install Pillow
  - python setup.py 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...

Derniers articles
Butinage n°66 Butinage n°66 22/05/2015 Dix-huitième exemplaire 2015 de la veille régulière réalisée par Makina Corpus sur l'actualité web. Simon Georges
Newsletter Makina Corpus - mai 2015 21/05/2015 Notre agenda à venir, bloquez les dates ! Anael Boulier
Comment contractualiser un projet en mode agile ?Comment contractualiser un projet en mode agile ? 21/05/2015 Le cas des marchés publics Cindy Jeanblanc et Catherine Tillous
Petit déjeuner "Améliorer son référencement avec Drupal" le 17 juin à ToulousePetit déjeuner "Améliorer son référencement avec Drupal" le 17 juin à Toulouse 21/05/2015 Avant de consulter un référenceur pour améliorer son positionnement, en maîtrisant la configuration de Drupal, vous pouvez déjà largement améliorer la perception de votre site par les moteurs de recherche. Anael Boulier