Still in my search for the perfect map for my N900, I started growing envious in
Google's relief mode. I have to confess that I am a map junkie (I've been amazed
with them since ever) and, for me, mountains are an importantant part of
city life's background, if not the center of certain activities like trekking, skiing or
climbing. So having a map application like `marble` feeded with maps I designed
with high contrast and hill shading is good, but not enough, but it seemed that,
short of abusing gmaps' tiles, there was no option for now.

Then a few days ago I crossed [an article in InfoWorld](http://www.infoworld.com/d/application-development/great-open-source-map-tools-web-developers-198012)
that talks about alternatives, and I got hooked with the first one,
[TileMill](http://mapbox.com/tilemill/), particularily because of its page on
[working with terrain data](http://mapbox.com/tilemill/docs/guides/terrain-data/).
So I'll try to explore it in this post, or at least install it.

First things first, [download the code](http://github.com/mapbox/tilemill) and
[the dependencies](http://mapbox.com/tilemill/docs/source/):

    build-essential
    libwebkit-dev
    libmapnik
    libmapnik-dev
    mapnik-utils
    nodejs
    nodejs-dev
    npm

`libmapnik` does not exist in Debian `sid`, but installing `libmapnik-dev` takes
care of it. In my case, a machine that barely has `build-essential`, we're
talking about 100+MiB in packages. It also needs `libsigc++-dev`, which is
not listed as a dep.

Then after the compilation finished (I had to do an ugly `sudo ln -s
/usr/lib/i386-linux-gnu/sigc++-2.0/include/sigc++config.h /usr/include/sigc++-2.0/`
trick to make the compiler find that file) I got this:

    $ ./index.js

    module.js:337
        throw new Error("Cannot find module '" + request + "'");
              ^
    Error: Cannot find module '../build/Release/node_sqlite3.node'
        at Function._resolveFilename (module.js:337:11)
        at Function._load (module.js:279:25)
        at Module.require (module.js:359:17)
        at require (module.js:375:17)
        at Object.<anonymous> (/home/mdione/src/projects/tilemill/node_modules/sqlite3/lib/sqlite3.js:1:104)
        at Module._compile (module.js:446:26)
        at Object..js (module.js:464:10)
        at Module.load (module.js:353:32)
        at Function._load (module.js:311:12)
    at Module.require (module.js:359:17

I'm gonna say in my defense that I know *nothing* about `node.js`, so I can't
really say, but when a module I just installed, and one with so many users as I
think the `sqlite3` one must have, doesn't work because of some path problem, I
think it smells fishy.

Debian to the rescue. I simply:

    $ rm -rf node_modules/sqlite3/
    $ sudo apt-get install node-sqlite3

And it runs without a hitch:

    $ ./index.js
    [tilemill] Creating configuration dir /home/mdione/.tilemill
    [tilemill] Creating files dir /home/mdione/Documents/MapBox
    [tilemill] Creating export dir /home/mdione/Documents/MapBox/export
    [tilemill] Creating project dir /home/mdione/Documents/MapBox/project
    [tilemill] Started [Server Tile:20008].
    [tilemill] Creating cache dir /home/mdione/Documents/MapBox/cache
    [tilemill] Plugin [editor] loaded.
    [tilemill] Plugin [carto] loaded.
    [tilemill] Plugin [templates] loaded.
    [tilemill] Plugin [fonts] loaded.
    [tilemill] Started [Server Core:20009].
    [tilemill] Client window created (pass --server=true to disable this)
    [tilemill] Checking for new version of TileMill...
    [tilemill] npm http GET https://registry.npmjs.org/tilemill
    [tilemill] npm
    [tilemill]  http 200 https://registry.npmjs.org/tilemill
    [tilemill] Latest version of TileMill is 0.9.1.

# Update

When running TileMill and trying to do anything I got this message:

    Unknown child node in 'Map': 'Parameters'

As per [this post](https://github.com/migurski/TileStache/issues/68) and
TileMill's instructions to [build from source](http://mapbox.com/tilemill/docs/source/),
and I quote, «If the error has to do with node-mapnik then you likely have a
Mapnik version that is too old». So I sat down, did some judo takes to put
`mapnik` from git into very nice Debian packages. I'm not proud about the battle;
as all wars it was messy, and not all of it was completely legal. But I can assure
you that after installing an unreleased version of it, and rebuilding its binding
for `node.js` (see the "Updating" section at the bottom of the
[build from source](http://mapbox.com/tilemill/docs/source/), but
`rm -rf node_modules/mapnik/` first), it works.

TODO:

* Resolve more dependencies with Debian packages.
* Play with it
* ...
* Profit!
