Skip to content
Simple Ruby FFI wrapper for Mapnik
Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
config
lib
spec
.gitignore
.rspec
.rubocop.yml
.travis.yml
Gemfile
LICENSE
LICENSE-ffi-mapnik
README.md
Rakefile
coveralls.yml
simple_mapnik.gemspec

README.md

SimpleMapnik

Build Status Coverage Status Gem Version

Simple ruby access to the Mapnik library using ruby-ffi and mapnik-c-api. Adapted from ffi-mapnik.

Prerequisites

SimpleMapnik requires that Mapnik 3.x or 2.x be installed at /usr/local/lib/libmapnik.*. The gem comes with a pre-built c api library compiled on OSX 10.10.5. For linux a C++ compiler and build environment is needed.

If the OSX binary does not work, the library can be compiled (after installing a build environment) by running:

$ rake api:build 

Mac OS X:

Linux:

Installation

Install from the latest tagged release:

$ gem install simple_mapnik

Or, add it to the Gemfile of an existing project:

gem 'simple_mapnik'

Then run:

$ bundle install

Usage

Open an IRB session, or run bin/mapnik_console:

require './lib/simple_mapnik' # not necessary if using bin/mapnik_console

SimpleMapnik.register_datasources '/usr/local/lib/mapnik/input'

map = SimpleMapnik::Map.new 256, 256
map.load 'spec/fixtures/sample/stylesheet.xml'
map.zoom_all
map.to_file '~/Desktop/sample_output.png'

Testing

$ bundle install
$ rake spec
You can’t perform that action at this time.