Mapnik 3.0.12 Release Sep 08, 2016 | Artem Pavlenko
Mapnik 3.0.10 Release Feb 29, 2016 | Artem Pavlenko
Node Mapnik 3.5.0 Release Feb 29, 2016 | Sam Matthews
Mapnik 3.0.9 Release Nov 26, 2015 | Artem Pavlenko
Mapnik 3.0.7 and 3.0.8 Releases Oct 26, 2015 | Artem Pavlenko
Mapnik 3.0.6 Release Oct 08, 2015 | Artem Pavlenko
Mapnik 3.0.5 Release Sep 17, 2015 | Artem Pavlenko
Mapnik 3.0.4 Release Aug 26, 2015 | Artem Pavlenko
Introducing a Color Blind Filter Aug 14, 2015 | Blake Thompson
Mapnik 3.0.3 Release Aug 12, 2015 | Artem Pavlenko
Mapnik 3.0.2 Release Jul 31, 2015 | Blake Thompson
Node Mapnik 3.4.1 Release Jul 31, 2015 | Blake Thompson

latest news

Using image filters and compositing together

Apr 26, 2012

Following up last week’s post about smart halos, I wanted to share some ways of using compositing and filters together to achieve interesting effects.

As a starting point we use the smart halos map from the previous posting. You can find the features used in this post in the [compositing branch](https://github.com/mapnik/mapnik/tree/compositing) Mapnik 2.1 release. Just be aware that these new features are work-in-progress and some syntax might change in future releases.

Deep water

Here is the original style:

Original

Let’s look at water bodies and land. Solid fills are looking good, but what about adding some texture to the map? One way to add ‘texture’ is to use <pre><PolygonPatternSymbolizer/></pre>

Let’s grab one of the lovely watercolour patterns and apply to ‘water’ features.

Water pattern

Very nice so far, perhaps a bit flat. Now time to add some depth. One of the very useful image processing tools is the ability to apply various blurs. In this case I use ‘agg-stack-blur’ with both x/y radius’ set to 10 pixels:

<Style name="water-shadow" image-filters="agg-stack-blur(10,10)" comp-op="dst-over">
	<Rule>
		<Filter>([HYC]=8)</Filter>
		<PolygonSymbolizer fill="lightblue" fill-opacity="0.4" smooth="0.7" transform="translate(0,0)" />
	</Rule>
</Style>

Deep water

And lastly I add a bit of texture to the land fill to get that ‘paper’ feel to the final map :

Final

I’m not sure the last step adds much to the cartography but it’s good to try different things. So go ahead and grab the latest source from [compositing branch](https://github.com/mapnik/mapnik/tree/compositing) Mapnik 2.1 and have fun!

Ooh, one more.. I really like ‘blur’ filters, they seem to be so versatile. Here is a water-floating-shadow style using a combination of ‘emboss’ and ‘agg-stack-blur’ filters, and also applying transform on the shadow symbolizer

transform="translate(10,10)"

Floating water

Floating water

Note, that while the water is floating in the air, all roads are on top of it - funky :)

Copyright © 2016 Artem Pavlenko | Downloads | License | Media