Skip to content

Latest commit

 

History

History
98 lines (64 loc) · 3.15 KB

README.md

File metadata and controls

98 lines (64 loc) · 3.15 KB

What is the mapnik-clj project?

Mapnik-clj wraps the Mapnik C++ API in Clojure. Mapnik is an API for building beautiful maps. Projects like CartoDB and TileMill use it for rending and tiling thier map tiles.

Here's our first tile!

Let's get started

This project depends on the mapnik-jni for Java Mapnik bindings.

Install Mapnik & Friends

To use Mapnik-clj you'll need a local installation of Mapnik.

OS X

On OS X Lion, install Mapnik with homebrew:

brew update
sudo chown -R $USER /Library/Python # for OS X Python
brew install --use-clang  mapnik

If cairomm fails, you may need to install it with Macports before proceeding:

sudo port install cairomm

If you're still stuck, another option is this Homebrew recipe.

Ubuntu

To install Mapnik on Ubuntu, fire up your command line and type:

sudo apt-get install build-essential curl wget python-software-properties
sudo add-apt-repository ppa:mapnik/nightly-trunk
sudo apt-get update
sudo apt-get install libmapnik libmapnik-dev mapnik-utils

Mapnik-JNI

Building Mapnik-JNI requires Ant, a Java build tool and cairomm, a C++ wrapper for the cairo graphics library.

OS X Lion

The OS X bindings have been prebuilt and uploaded to the mapnik-clj download page. Download the OS X native binding and place it somewhere on JAVA_LIBRARY_PATH. (I prefer /opt/local/lib). Check if everything's dandy by running lein midje in the project directory.

If you get an UnsatisfiedLinkException, you'll probably have to build the bindings from scratch for you own system. To do this, run the follow commands in the terminal:

git clone https://github.com/SpatialInteractive/mapnik-jni.git`
cd mapnik-jni
ant test

The OS X native binding will be located at build/dist/libmapnik-jni.jnilib in the mapnik-jni directory. Use this instead of the mapnik-clj-supplied binding and you should be good to go.

Ubuntu

On Ubuntu you can install Ant and cairomm like this:

sudo apt-get install ant1.7 ant-optional libcairomm-1.0-1 libcairomm-1.0-dev

After that, you can build Mapnik-JNI like this:

# Clone Mapnik
git clone https://github.com/mapnik/mapnik.git
cd mapnik

# Download and apply this patch: https://gist.github.com/1626582
curl -O https://raw.github.com/gist/1626582/80f081a55bf3ab938fa96020c76160b49bcd04a4/ltdl-mapnik.diff
git apply ltdl-mapnik.diff

# Build and install Mapnik
./configure
make
sudo make install

# Clone Dane's fork of Mapnik-jni
cd ../
git clone https://github.com/springmeyer/mapnik-jni
cd mapnik-jni
ant test
ant

Move the native binding inside of build/dist to somewhere on JAVA_LIBRARY_PATH and you'll be ready to move on to the project demo.