Printing high-res world map posters with custom projection using TileMill and Python.

How is learned about map projections, map lovers and started to hate 180th Meridian.

Jakub Klaučo
Apr 14, 2018 · 4 min read


Plan was to get a huge poster map for the wall in our apartment. My SO was very specific with requirements.

  1. The land part should be white so we can use markers to write custom stuff.
  2. There should be no text on the map.
  3. Only borders of the countries are visible.
  4. Whole map should be in grey-scale.
  5. The map should be approximately 2m wide to fit our wall.

After brief research it was obvious that there are no pre-made maps that fit this description. It was time to make my own. I experimented with Google Maps and create a python script that accomplishes it. I wrote about it here.

  1. Questionable licensing.
  2. Limited amount of layers.(Wanted to add some more depth to the oceans)
  3. Output is not in vector format.(For huge prints vector is preferred)
  4. Projection. Google uses Web Mercator.

Why should I care about projection ?

As mentioned Google uses web Mercator projection. This is great for using in a web maps but not that great for making wall map out of it.

North is up everywhere, meridians are equally spaced vertical lines, but areas near the poles are greatly exaggerated.

Image for post
Image for post
Example of WebMercator image, issue ? Greenland is Huge.

If you wan’t to learn about projections there is XKCD with great summary, or more technical intro into projections.

My goal was to pick projection with square output (this limits my use of some cool projections out there) and reasonable size of areas close to the poles. For that reason I picked Gall Stereographic.


  1. Map creation
  2. Use Mapnik to change projection (Python)
  3. Generate PDF output (Python)

After brief research I decided to use TileMill even though it’s not being actively developed. Main reason was ability to output Mapnik XML. As far as I searched I was not able to find any other tool that I can use to export file in SVG with custom projection.

Image for post
Image for post
TileMill configuration

Working with TileMill is straightforward but using Carto-CSS can be little tricky for the first time. I created 3 layers. Countries, Ocean(Bathymetry), Lakes. All layers are sourced from pre-configured TileMill sources. CSS altered to suit my requirements:

As TileMill supports only Web Mercator next step is moving model into the Mapnik and transforming it. Luckily TileMill offers export to Mapnik XML.

I used Python interface to change and export projection.( Jupyter Notebook examples included)

Install dependencies

Then you have to take mapnik.xml and change projection to that of your own selection(Bold text). Make sure that you have correct path for shapefiles (Map data dependencies which are saved by TileMill). To find XML definition of projection use SpatialReference website.

Exporting PDF is straightforward process.


Sadly there is no way !(Please prove me wrong :) ) to export map over 180th meridian.(Timeline between US and Russia) Anytime you cross this line in an export it glitches into weird shapes all over the map. This means that I am unable to widen the map output.
I am however happy with the results :

Image for post
Image for post
Gall Stereographic projection output example.


You can find code that I used here.

If you know how to cross 180th Meridian please let me know :)

Image for post
Image for post

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store