0.0
No commit activity in last 3 years
No release in over 3 years
Simple FFI wrapper for Mapnik
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
 Dependencies

Development

Runtime

~> 1.12
~> 1.9.0
>= 0
~> 1.2.0
 Project Readme

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