Giter Club home page Giter Club logo

ruby-mapnik's Introduction

Ruby Mapnik

github.com/mapnik/Ruby-Mapnik

<img src=“https://travis-ci.org/mapnik/Ruby-Mapnik.svg?branch=master” alt=“Build Status”>

Requirements

On OS X install ruby deps like:

export ARCHFLAGS="-arch x86_64"
gem install rake-compiler rake hoe rice chunky_png cairo

Description

A set of bindings between Ruby and Mapnik. Supports many of the common uses for Mapnik, and one day, might support all of them. Rendering is available using the standard AGG library, or additionally via Cairo, if the rcairo gem is installed and Mapnik has been compiled with Cairo support.

Installation

If you have checked out this local repository code build like:

rake

The above command will compile the bindings and run the tests.

File issues at github.com/mapnik/Ruby-Mapnik/issues if you hit any compile errors.

To create a gem from your local repository and install it run:

rake gem
gem install pkg/mapnik-0.x.y.gem

Alternatively, if you wish to install Ruby-Mapnik from the latest tagged release you can do:

gem install mapnik

Note: on osx the default rake compile will try to build universal, and your mapnik install is unlikely built universal. Check the architecture of libmapnik.dylib like:

file /usr/local/lib/libmapnik.dylib

On a system where your compiler defaults to 64bit you’ll see: ‘Mach-O 64-bit dynamically linked shared library x86_64’

So to avoid a linking warning like:

ld: warning: ignoring file /usr/local/lib/libmapnik.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

You can pass this before rake compile:

export ARCHFLAGS="-arch x86_64"

Synopsis

require 'mapnik'

map = Mapnik::Map.new do |m|

  # A grey background
  m.background = Mapnik::Color.new('#777')

  # Use the Google mercator projection
  m.srs =  Mapnik::Tile::DEFAULT_OUTPUT_PROJECTION

  # Add a layer to the map
  m.layer 'countries' do |l|

    # Add a style to the layer
    l.style do |s|

      # Add a rule to the style (this one is a default rule)
      s.rule do |default|

        #fill the shapes with polygon symbolizers
        default.fill = Mapnik::Color.new('#880000')
      end
    end

    # set the srs of the layer
    l.srs = "+proj=latlong +datum=WGS84"

    #specify the datasource for the layer
    l.datasource = Mapnik::Datasource.create :type => 'shape', :file => "#{PATH}/../data/TM_WORLD_BORDERS_SIMPL_0.3_MOD"
  end

end

map.zoom_to_box(map.layers.first.envelope) 
map.render_to_file('my_map.png')

Examples

See demo/rundemo.rb for the classic mapnik rundemo. Also see demo/sinatra/demo.rb for a simple tile server (requires the sinatra gem).

Thanks

Thanks to the Mapnik team and especially to Dane Springmeyer!

ruby-mapnik's People

Contributors

alno avatar das-g avatar elliotlaster avatar gravitystorm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby-mapnik's Issues

expose wkb parsing

low priority, but mapnik2 very recently added wkb reading api that matches the wkt api. this stuff has been evolving (and still may change a bit in trunk) but now that mapnik2 has been released supporting wkb reading would be good (matching the python bindings).

extension does not build on OS X

hello guys,

first of all, thanks for your hard work!

i have trouble installing the gem on my system. after fixing the gemspec it still wont build the gem :(

my error:

cd tmp/x86_64-darwin11.3.0/ruby_mapnik/1.9.3
make
compiling ../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/../to_from_ruby.hpp:5,
                 from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/Auto_Function_Wrapper.ipp:12,
                 from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/Auto_Function_Wrapper.hpp:826,
                 from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/wrap_function.ipp:10,
                 from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/wrap_function.hpp:338,
                 from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/define_method_and_auto_wrap.ipp:4,
                 from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/define_method_and_auto_wrap.hpp:29,
                 from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/Module_impl.ipp:1,
                 from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/Module.ipp:4,
                 from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/Class.ipp:4,
                 from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/Class.hpp:5,
                 from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/Data_Type.ipp:4,
                 from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/Data_Type_defn.hpp:258,
                 from /Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/Data_Type.hpp:4,
                 from ../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:27:
/Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/../to_from_ruby.ipp: In function ‘typename Rice::detail::from_ruby_<T>::Retval_T from_ruby(Rice::Object) [with T = int]’:
/Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/../to_from_ruby.ipp:42: warning: implicit conversion shortens 64-bit value into a 32-bit value
/Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/../to_from_ruby.ipp: In function ‘typename Rice::detail::from_ruby_<T>::Retval_T from_ruby(Rice::Object) [with T = unsigned int]’:
/Users/ben/.rvm/gems/ruby-1.9.3-p194@mapnik/gems/rice-1.4.3/ruby/lib/include/rice/detail/../to_from_ruby.ipp:104: warning: implicit conversion shortens 64-bit value into a 32-bit value
In file included from /usr/local/Cellar/mapnik/2.0.1/include/mapnik/feature.hpp:28,
                 from ../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:33:
/usr/local/Cellar/mapnik/2.0.1/include/mapnik/value.hpp: In member function ‘int mapnik::impl::to_int::operator()(double) const’:
/usr/local/Cellar/mapnik/2.0.1/include/mapnik/value.hpp:678: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp: At global scope:
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:44: error: ‘context_ptr’ in namespace ‘mapnik’ does not name a type
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:57: error: ‘context_ptr’ in namespace ‘mapnik’ does not name a type
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp: In constructor ‘<unnamed>::context_holder::context_holder()’:
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:48: error: class ‘<unnamed>::context_holder’ does not have any field named ‘ptr’
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:48: error: ‘context_type’ is not a member of ‘mapnik’
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:48: error: ‘context_type’ is not a member of ‘mapnik’
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:48: error: no matching function for call to ‘make_shared()’
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp: In member function ‘int<unnamed>::context_holder::push(const std::string&)’:
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:54: error: ‘ptr’ was not declared in this scope
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp: At global scope:
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:65: error: expected constructor, destructor, or type conversion before ‘from_ruby’
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp: In function ‘void register_feature(Rice::Module)’:
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:79: error: ‘context_ptr’ is not a member of ‘mapnik’
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:79: error: ‘context_ptr’ is not a member of ‘mapnik’
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:79: error: template argument 2 is invalid
/usr/local/Cellar/mapnik/2.0.1/include/mapnik/feature.hpp: In member function ‘unsigned int mapnik::feature<T1, T2>::num_geometries() const [with T1 = mapnik::geometry<mapnik::vertex<double, 2>, mapnik::vertex_vector>, T2 = boost::shared_ptr<mapnik::raster>]’:
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:82:   instantiated from here
/usr/local/Cellar/mapnik/2.0.1/include/mapnik/feature.hpp:99: warning: implicit conversion shortens 64-bit value into a 32-bit value
make: *** [_mapnik_feature.rb.o] Error 1
rake aborted!
Command failed with status (2): [make...]

Tasks: TOP => default => test => compile => compile:x86_64-darwin11.3.0 => compile:ruby_mapnik:x86_64-darwin11.3.0 => copy:ruby_mapnik:x86_64-darwin11.3.0:1.9.3 => tmp/x86_64-darwin11.3.0/ruby_mapnik/1.9.3/ruby_mapnik.bundle
(See full trace by running task with --trace)

versions
mapnik: 2.0.1 (build via homebrew)
gem: master branch of the repository
ruby: 1.9.3p194
os: os x 10.7

please let me know what else you need to track this down!

gem install on Ubuntu 12.04 failing

alibby@tilea:~/mapnik$ gem install ruby_mapnik
Building native extensions. This could take a while...
ERROR: Error installing ruby_mapnik:
ERROR: Failed to build gem native extension.

    /home/alibby/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb

checking for main() in -lrice... yes
creating Makefile

make
compiling _mapnik_map.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_coord.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_font_engine.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_style.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_shield_symbolizer.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
_mapnik_shield_symbolizer.rb.cpp: In function ‘Rice::Object {anonymous}::get_shield_displacement(const mapnik::shield_symbolizer&)’:
_mapnik_shield_symbolizer.rb.cpp:39:18: error: ‘mapnik::position’ has no member named ‘first’
_mapnik_shield_symbolizer.rb.cpp:40:18: error: ‘mapnik::position’ has no member named ‘second’
make: *** [_mapnik_shield_symbolizer.rb.o] Error 1

Gem files will remain installed in /home/alibby/.rvm/gems/ruby-1.9.3-p194/gems/ruby_mapnik-0.1.4 for inspection.
Results logged to /home/alibby/.rvm/gems/ruby-1.9.3-p194/gems/ruby_mapnik-0.1.4/ext/ruby_mapnik/gem_make.out

Building Ruby-Mapnik fails running the tests

Most likely a minitest 5 compatibility issue:

/usr/bin/ruby -w -Ilib:bin:test:. -e 'require "rubygems"; require "minitest/autorun"; require "test/test_polygon_pattern_symbolizer.rb"; require "test/test_helper.rb"; require "test/test_mapnik_font_engine.rb"; require "test/test_mapnik_symbolizer.rb"; require "test/test_mapnik_expression.rb"; require "test/test_mapnik_line_symbolizer.rb"; require "test/test_mapnik_coord.rb"; require "test/test_mapnik_map.rb"; require "test/test_mapnik_markers_symbolizer.rb"; require "test/test_line_pattern_symbolizer.rb"; require "test/test_mapnik_datasource.rb"; require "test/test_mapnik_stroke.rb"; require "test/test_mapnik_raster_colorizer.rb"; require "test/test_mapnik_envelope.rb"; require "test/test_mapnik_style.rb"; require "test/test_mapnik_raster_symbolizer.rb"; require "test/test_mapnik_layer.rb"; require "test/test_mapnik_color.rb"; require "test/test_mapnik_rule.rb"; require "test/test_mapnik_shield_symbolizer.rb"; require "test/test_mapnik_point_symbolizer.rb"; require "test/test_mapnik_text_symbolizer.rb"; require "test/test_mapnik_feature.rb"; require "test/test_mapnik_polygon_symbolizer.rb"; require "test/test_mapnik_projection.rb"; require "test/test_ruby_mapnik.rb"' -- 
MiniTest::Unit::TestCase is now Minitest::Test. From /usr/share/ruby/test/unit/testcase.rb:8:in `<module:Unit>'
/usr/share/ruby/test/unit.rb:670:in `<class:Runner>': undefined method `_run_suite' for class `Test::Unit::Runner' (NameError)
    from /usr/share/ruby/test/unit.rb:255:in `<module:Unit>'
    from /usr/share/ruby/test/unit.rb:9:in `<module:Test>'
    from /usr/share/ruby/test/unit.rb:8:in `<top (required)>'
    from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/tom/src/osm/Ruby-Mapnik/test/test_helper.rb:22:in `<top (required)>'
    from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/tom/src/osm/Ruby-Mapnik/test/test_polygon_pattern_symbolizer.rb:1:in `<top (required)>'
    from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'
rake aborted!
Command failed with status (1): [/usr/bin/ruby -w -Ilib:bin:test:. -e 'requ...]

rake compile should stop unless 'mapnik-config' is found

'command not found' is printed but execution continues on...

Ruby-Mapnik dane$ rake compile
rake/rdoctask is deprecated.  Use rdoc/task instead (in RDoc 2.4.2+)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I. ../../../../ext/ruby_mapnik/extconf.rb
checking for main() in -lrice... yes
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:36: command not found: mapnik-config --cflags
creating Makefile
make
g++ -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I../../../../ext/ruby_mapnik -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE    -I/usr/local/include -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    -Wall -g -c ../../../../ext/ruby_mapnik/_mapnik.cpp
g++ -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I../../../../ext/ruby_mapnik -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE    -I/usr/local/include -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    -Wall -g -c ../../../../ext/ruby_mapnik/_mapnik_color.rb.cpp
../../../../ext/ruby_mapnik/_mapnik_color.rb.cpp:28:28: error: mapnik/color.hpp: No such file or directory
../../../../ext/ruby_mapnik/_mapnik_color.rb.cpp:30: error: ‘mapnik’ has not been declared
../../../../ext/ruby_mapnik/_mapnik_color.rb.cpp:30: error: ‘mapnik’ has not been declared

Compile error for ubuntu 12.04: boost/make_shared.hpp missing

I've been trying to install the gem on ubuntu 12.04.

The best luck I've had so far is using the ppas on https://github.com/mapnik/mapnik/wiki/UbuntuInstallation, but the gem's failing to compile now.

I've tried with gem install ruby_mapnik, and cloning the repo and running rake. Both give me

Building native extensions.  This could take a while...
ERROR:  Error installing ruby_mapnik:
ERROR: Failed to build gem native extension.

/home/wstrinz/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
extconf.rb:38:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:38:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:39:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
creating Makefile

make
compiling _mapnik_feature.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for     C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for     C/ObjC but not for C++ [enabled by default]
_mapnik_feature.rb.cpp:24:33: fatal error: boost/make_shared.hpp: No such file or     directory
compilation terminated.
make: *** [_mapnik_feature.rb.o] Error 1

I'm guessing based on the fatal error: boost/make_shared.hpp: No such file or directory line that there may be a problem with my libboost installation, but I'm not sure how to go about attacking it.

Using ruby-2.0.0-p247 by the way.

Thanks!

Unable to convert Fixnum to long long (mapnik::value_integer)

When running the tests we receive the error:

  1) Error:
test_should_add_a_geometry(TestMapnikFeature):
ArgumentError: Unable to convert Fixnum to long long

The test is straighforward:

assert feature = Mapnik::Feature.new(Mapnik::Context.new, 1)

There are four identical failing tests, unsurprisingly! The constructor takes a value_integer type:

rb_cfeature.define_constructor(Rice::Constructor< mapnik::Feature,mapnik::context_ptr,value_integer >());

... and value_integer is defined based on the mapnik_version:

#if MAPNIK_VERSION >= 200200
       typedef mapnik::value_integer value_integer;
#else
       typedef int value_integer;
#endif

... and of course, mapnik::value_integer is defined in mapnik as a long long (2.2.0, 2.3.x)

I've found some advice from rice mailing list posts and docs that suggest we need to explicitly convert the fixnum into a long long, but I don't know actually how to do that i.e. what code to put where. Within _mapnik_colour.cpp there is an example of using NUM2INT, which might provide a clue, but I don't know where to go from here.

Suggestions welcome!

22 failing tests on ubuntu 11.04 with ruby 1.9.2

Several of these are due to geometry api change upstream in mapnik, but others likely should not be happening:

$ rake-ruby-1.9.2-p290 test
#<Gem::LoadError: Could not find rdoc (>= 0) amongst [ZenTest-4.6.2, hoe-2.12.3, rake-0.9.2, rake-compiler-0.7.9, rice-1.4.2]>
rake/rdoctask is deprecated.  Use rdoc/task instead (in RDoc 2.4.2+)
/home/mapnik/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -w -Ilib:bin:test:. -e 'require "rubygems"; require "test/unit"; require "test/test_helper.rb"; require "test/test_mapnik_line_symbolizer.rb"; require "test/test_mapnik_expression.rb"; require "test/test_ruby_mapnik.rb"; require "test/test_mapnik_feature.rb"; require "test/test_mapnik_glyph_symbolizer.rb"; require "test/test_mapnik_style.rb"; require "test/test_mapnik_map.rb"; require "test/test_mapnik_raster_symbolizer.rb"; require "test/test_mapnik_coord.rb"; require "test/test_mapnik_datasource.rb"; require "test/test_mapnik_color.rb"; require "test/test_mapnik_envelope.rb"; require "test/test_mapnik_rule.rb"; require "test/test_line_pattern_symbolizer.rb"; require "test/test_mapnik_font_engine.rb"; require "test/test_mapnik_projection.rb"; require "test/test_mapnik_symbolizer.rb"; require "test/test_mapnik_text_symbolizer.rb"; require "test/test_mapnik_polygon_symbolizer.rb"; require "test/test_polygon_pattern_symbolizer.rb"; require "test/test_mapnik_raster_colorizer.rb"; require "test/test_mapnik_geometry.rb"; require "test/test_mapnik_point_symbolizer.rb"; require "test/test_mapnik_shield_symbolizer.rb"; require "test/test_mapnik_markers_symbolizer.rb"; require "test/test_mapnik_layer.rb"; require "test/test_mapnik_stroke.rb"' -- 
Loaded suite -e
Started
...........................................E......EEEEEE......................E..................E.E.EEEE.E.................EE.EE..............E......................................E......E...........................................
Finished in 0.238084 seconds.

  1) Error:
test_should_add_a_geometry(TestMapnikFeature):
NoMethodError: undefined method `add_geometry' for feature (
  id:1
)
:Mapnik::Feature
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_feature.rb:29:in `test_should_add_a_geometry'

  2) Error:
test_should_make_linestring_from_wkt(TestMapnikGeometry):
NoMethodError: undefined method `from_wkt' for Mapnik::Geometry2d:Class
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_geometry.rb:26:in `test_should_make_linestring_from_wkt'

  3) Error:
test_should_make_multilinestring_from_wkt(TestMapnikGeometry):
NoMethodError: undefined method `from_wkt' for Mapnik::Geometry2d:Class
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_geometry.rb:55:in `test_should_make_multilinestring_from_wkt'

  4) Error:
test_should_make_multipoint_from_wkt(TestMapnikGeometry):
NoMethodError: undefined method `from_wkt' for Mapnik::Geometry2d:Class
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_geometry.rb:46:in `test_should_make_multipoint_from_wkt'

  5) Error:
test_should_make_multipolygon_from_wkt(TestMapnikGeometry):
NoMethodError: undefined method `from_wkt' for Mapnik::Geometry2d:Class
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_geometry.rb:64:in `test_should_make_multipolygon_from_wkt'

  6) Error:
test_should_make_point_from_wkt(TestMapnikGeometry):
NoMethodError: undefined method `from_wkt' for Mapnik::Geometry2d:Class
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_geometry.rb:16:in `test_should_make_point_from_wkt'

  7) Error:
test_should_make_polygon_from_wkt(TestMapnikGeometry):
NoMethodError: undefined method `from_wkt' for Mapnik::Geometry2d:Class
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_geometry.rb:36:in `test_should_make_polygon_from_wkt'

  8) Error:
test_should_have_styles(TestMapnikLayer):
NameError: undefined local variable or method `__style_list__' for #<Mapnik::Layer:0x000000020c3f30>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/layer.rb:60:in `styles'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_layer.rb:118:in `test_should_have_styles'

  9) Error:
test_should_have_layers(TestMapnikMap):
NameError: undefined local variable or method `__layers__' for #<Mapnik::Map:0x000000020ae2c0>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/map.rb:145:in `layers'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_map.rb:131:in `test_should_have_layers'

 10) Error:
test_should_have_styles(TestMapnikMap):
NameError: undefined local variable or method `__styles__' for #<Mapnik::Map:0x000000020adaf0>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/map.rb:126:in `styles'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_map.rb:18:in `test_should_have_styles'

 11) Error:
test_should_load_from_file(TestMapnikMap):
NameError: undefined local variable or method `__layers__' for #<Mapnik::Map:0x000000020acdd0>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/map.rb:145:in `layers'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_map.rb:172:in `test_should_load_from_file'

 12) Error:
test_should_load_from_file_path_string(TestMapnikMap):
NameError: undefined local variable or method `__layers__' for #<Mapnik::Map:0x000000020ab8b8>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/map.rb:145:in `layers'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_map.rb:165:in `test_should_load_from_file_path_string'

 13) Error:
test_should_load_from_xml_string(TestMapnikMap):
NameError: undefined local variable or method `__symbols__' for #<Mapnik::Rule:0x000000020ab0e8>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/rule.rb:98:in `symbols'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_map.rb:189:in `build_complete_map'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_map.rb:156:in `test_should_load_from_xml_string'

 14) Error:
test_should_output_to_xml(TestMapnikMap):
NameError: undefined local variable or method `__symbols__' for #<Mapnik::Rule:0x000000020aa7d8>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/rule.rb:98:in `symbols'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_map.rb:189:in `build_complete_map'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_map.rb:141:in `test_should_output_to_xml'

 15) Error:
test_should_render_to_file(TestMapnikMap):
NameError: undefined local variable or method `__symbols__' for #<Mapnik::Rule:0x000000020a9c98>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/rule.rb:98:in `symbols'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_map.rb:189:in `build_complete_map'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_map.rb:147:in `test_should_render_to_file'

 16) Error:
test_should_forward_envelopes(TestMapnikProjection):
NoMethodError: undefined method `__forward_env__' for #<Mapnik::Projection:0x000000020a1098>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/projection.rb:28:in `forward'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_projection.rb:43:in `test_should_forward_envelopes'

 17) Error:
test_should_forward_points(TestMapnikProjection):
NoMethodError: undefined method `__forward_pt__' for #<Mapnik::Projection:0x000000020a0968>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/projection.rb:30:in `forward'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_projection.rb:38:in `test_should_forward_points'

 18) Error:
test_should_inverse_envelopes(TestMapnikProjection):
NoMethodError: undefined method `__inverse_env__' for #<Mapnik::Projection:0x000000020a00a8>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/projection.rb:37:in `inverse'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_projection.rb:33:in `test_should_inverse_envelopes'

 19) Error:
test_should_inverse_points(TestMapnikProjection):
NoMethodError: undefined method `__inverse_pt__' for #<Mapnik::Projection:0x0000000209f6d0>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/projection.rb:39:in `inverse'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_projection.rb:28:in `test_should_inverse_points'

 20) Error:
test_should_append_and_remove_symbols(TestMapnikRule):
NameError: undefined local variable or method `__symbols__' for #<Mapnik::Rule:0x00000002078d78>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/rule.rb:98:in `symbols'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_rule.rb:50:in `test_should_append_and_remove_symbols'

 21) Error:
test_should_have_dashes(TestMapnikStroke):
NameError: undefined local variable or method `__dashes__' for #<Mapnik::Stroke:0x00000001eaf050>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/stroke.rb:49:in `dashes'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_stroke.rb:81:in `test_should_have_dashes'

 22) Error:
test_should_have_rules(TestMapnikStyle):
NameError: undefined local variable or method `__rules__' for #<Mapnik::Style:0x00000001eab6d0>
    /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/style.rb:57:in `rules'
    /home/mapnik/src/Ruby-Mapnik/test/test_mapnik_style.rb:11:in `test_should_have_rules'

233 tests, 487 assertions, 0 failures, 22 errors, 0 skips

Test run options: --seed 1287
rake aborted!
Command failed with status (1): [/home/mapnik/.rvm/rubies/ruby-1.9.2-p290/b...]

Tasks: TOP => test
(See full trace by running task with --trace)

Missing installation instruction when compiling from source

The README describes how to build the extension using rake, but it's silent on what the next step is in order to actually install the bindings.

The aim is to be able to clone the repository, build and install the bindings such that require 'ruby_mapnik' works.

rundemo.rb should use xdg-open on linux

open on linux is a somewhat different command to open on macosx, and throws an unhelpful error:

Couldn't get a file descriptor referring to the console

xdg-open is a cross-distribution way to open the image, but doesn't work on macosx. A small amount of platform detection will be necessary.

Failed install with Mapnik 2.2.0-pre

After #47 I installed mapnik as described in "Install Mapnik library" section on http://switch2osm.org/serving-tiles/manually-building-a-tile-server-14-04/

mapnik-config -v gives 2.2.0-pre

running rake results in

Defaulting gemspec to MIT license.
Call license in hoe spec to change.
install -c tmp/i686-linux/ruby_mapnik/1.9.3/ruby_mapnik.so lib/ruby_mapnik/ruby_mapnik.so
cp tmp/i686-linux/ruby_mapnik/1.9.3/ruby_mapnik.so tmp/i686-linux/stage/lib/ruby_mapnik/ruby_mapnik.so
/usr/bin/ruby1.9.1 -w -Ilib:bin:test:. -e 'require "rubygems"; require "minitest/autorun"; require "test/test_mapnik_feature.rb"; require "test/test_ruby_mapnik.rb"; require "test/test_polygon_pattern_symbolizer.rb"; require "test/test_mapnik_projection.rb"; require "test/test_mapnik_rule.rb"; require "test/test_mapnik_color.rb"; require "test/test_mapnik_line_symbolizer.rb"; require "test/test_mapnik_layer.rb"; require "test/test_mapnik_raster_colorizer.rb"; require "test/test_mapnik_point_symbolizer.rb"; require "test/test_helper.rb"; require "test/test_mapnik_shield_symbolizer.rb"; require "test/test_line_pattern_symbolizer.rb"; require "test/test_mapnik_style.rb"; require "test/test_mapnik_polygon_symbolizer.rb"; require "test/test_mapnik_markers_symbolizer.rb"; require "test/test_mapnik_envelope.rb"; require "test/test_mapnik_coord.rb"; require "test/test_mapnik_map.rb"; require "test/test_mapnik_font_engine.rb"; require "test/test_mapnik_symbolizer.rb"; require "test/test_mapnik_expression.rb"; require "test/test_mapnik_stroke.rb"; require "test/test_mapnik_raster_symbolizer.rb"; require "test/test_mapnik_text_symbolizer.rb"; require "test/test_mapnik_datasource.rb"' -- 
/usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require': /home/mateusz/Documents/MapBox/Ruby-Mapnik/lib/ruby_mapnik/ruby_mapnik.so: undefined symbol: _ZN6mapnik4rule10set_filterERKN5boost10shared_ptrINS1_7variantINS1_6detail7variant14recursive_flagINS5_13over_sequenceINS1_3mpl8vector24INS_10value_nullEbxdN6icu_5213UnicodeStringENS_9attributeENS_23geometry_type_attributeENS1_17recursive_wrapperINS_10unary_nodeINS_4tags6negateEEEEENSF_INS_11binary_nodeINSH_4plusEEEEENSF_INSL_INSH_5minusEEEEENSF_INSL_INSH_4multEEEEENSF_INSL_INSH_3divEEEEENSF_INSL_INSH_3modEEEEENSF_INSL_INSH_4lessEEEEENSF_INSL_INSH_10less_equalEEEEENSF_INSL_INSH_7greaterEEEEENSF_INSL_INSH_13greater_equalEEEEENSF_INSL_INSH_8equal_toEEEEENSF_INSL_INSH_12not_equal_toEEEEENSF_INSG_INSH_11logical_notEEEEENSF_INSL_INSH_11logical_andEEEEENSF_INSL_INSH_10logical_orEEEEENSF_INS_16regex_match_nodeEEENSF_INS_18regex_replace_nodeEEEEEEEEENS5_5void_ES1Z_S1Z_S1Z_S1Z_S1Z_S1Z_S1Z_S1Z_S1Z_S1Z_S1Z_S1Z_S1Z_S1Z_S1Z_S1Z_S1Z_S1Z_EEEE - /home/mateusz/Documents/MapBox/Ruby-Mapnik/lib/ruby_mapnik/ruby_mapnik.so (LoadError)
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/mateusz/Documents/MapBox/Ruby-Mapnik/lib/ruby_mapnik.rb:27:in `<top (required)>'
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/mateusz/Documents/MapBox/Ruby-Mapnik/test/test_helper.rb:25:in `<top (required)>'
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/mateusz/Documents/MapBox/Ruby-Mapnik/test/test_mapnik_feature.rb:1:in `<top (required)>'
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'
rake aborted!
Command failed with status (1): [/usr/bin/ruby1.9.1 -w -Ilib:bin:test:. -e ...]

Tasks: TOP => default => test
(See full trace by running task with --trace)

error: ‘mapnik::path_processor_type’ has not been declared

I installed Mapnik v2.3.x as described on https://github.com/mapnik/mapnik/wiki/UbuntuInstallation (I admit that I used on Ubuntu 14.04 instructions for Ubuntu <14.04, but instruction go 14.04 LTS are missing).

mapnik-config -v

gives

2.3.0-pre
sudo add-apt-repository ppa:mapnik/nightly-2.3
sudo apt-get update
sudo apt-get install libmapnik libmapnik-dev mapnik-utils python-mapnik
# also install datasource plugins if you need them
sudo apt-get install mapnik-input-plugin-gdal mapnik-input-plugin-ogr\
  mapnik-input-plugin-postgis \
  mapnik-input-plugin-sqlite \
  mapnik-input-plugin-osm

I followed it by installing ruby_mapnik by running

gem install ruby_mapnik

it resulted in

mateusz@Grisznak:~$ gem install ruby_mapnik
Building native extensions.  This could take a while...
ERROR:  Error installing ruby_mapnik:
    ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
extconf.rb:38: Use RbConfig instead of obsolete and deprecated Config.
creating Makefile

make
compiling _mapnik_line_pattern_symbolizer.rb.cpp
_mapnik_line_pattern_symbolizer.rb.cpp: In function ‘const string get_filename(const mapnik::line_pattern_symbolizer&)’:
_mapnik_line_pattern_symbolizer.rb.cpp:33:18: error: ‘mapnik::path_processor_type’ has not been declared
   return mapnik::path_processor_type::to_string(*t.get_filename()); 
                  ^
_mapnik_line_pattern_symbolizer.rb.cpp: In function ‘void set_filename(mapnik::line_pattern_symbolizer&, const string&)’:
_mapnik_line_pattern_symbolizer.rb.cpp:37:18: error: ‘parse_path’ is not a member of ‘mapnik’
   t.set_filename(mapnik::parse_path(file_expr)); 
                  ^
_mapnik_line_pattern_symbolizer.rb.cpp: In function ‘const string get_filename(const mapnik::line_pattern_symbolizer&)’:
_mapnik_line_pattern_symbolizer.rb.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make: *** [_mapnik_line_pattern_symbolizer.rb.o] Error 1


Gem files will remain installed in /home/mateusz/.gem/ruby/1.9.1/gems/ruby_mapnik-0.1.5 for inspection.
Results logged to /home/mateusz/.gem/ruby/1.9.1/gems/ruby_mapnik-0.1.5/ext/ruby_mapnik/gem_make.out

geometry compile errors


g++ -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I../../../../ext/ruby_mapnik -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE     -I/usr/local/include -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common -I/usr/local/include -I/opt/sqlite-3070701/include -I/opt/boost-47-static/include -I/Library/Frameworks/UnixImageIO.framework/Versions/D/Headers -I/Library/Frameworks/GDAL.framework/Versions/1.8/Headers -I/usr/local/pgsql-9.0/include -I/usr/local/Cellar/geos/3.3.0/include -I/usr/local/include -I/usr/include -I/usr/X11/include/freetype2 -I/usr/X11/include -I/usr/include/libxml2 -isystem /opt/boost-47-static/include -g -DHAVE_JPEG -ansi -Wall -ftemplate-depth-300 -DDARWIN -DBOOST_SPIRIT_THREADSAFE -DMAPNIK_THREADSAFE -O2 -finline-functions -Wno-inline -DNDEBUG -DLIBTOOL_SUPPORTS_ADVISE -DHAVE_LIBXML2  -Wall -g -c ../../../../ext/ruby_mapnik/_mapnik_geometry.rb.cpp
/usr/local/include/mapnik/wkt/wkt_factory.hpp: In function ‘mapnik::geometry_type*<unnamed>::make_from_wkt(const std::string&)’:
/usr/local/include/mapnik/wkt/wkt_factory.hpp:32: error: too few arguments to function ‘bool mapnik::from_wkt(const std::string&, boost::ptr_vector<mapnik::geometry<mapnik::vertex<double, 2>, mapnik::vertex_vector>, boost::heap_clone_allocator, std::allocator<void*> >&)’
../../../../ext/ruby_mapnik/_mapnik_geometry.rb.cpp:37: error: at this point in file
/usr/local/include/mapnik/wkt/wkt_factory.hpp: In function ‘mapnik::geometry_type*<unnamed>::make_from_wkt(const std::string&)’:
/usr/local/include/mapnik/wkt/wkt_factory.hpp:32: error: too few arguments to function ‘bool mapnik::from_wkt(const std::string&, boost::ptr_vector<mapnik::geometry<mapnik::vertex<double, 2>, mapnik::vertex_vector>, boost::heap_clone_allocator, std::allocator<void*> >&)’
../../../../ext/ruby_mapnik/_mapnik_geometry.rb.cpp:37: error: at this point in file
lipo: can't open input file: /var/folders/Je/Je-B-XguGWyDz+BVgq4Swk+++TI/-Tmp-//cc8xjlfq.out (No such file or directory)
make: *** [_mapnik_geometry.rb.o] Error 1
rake aborted!
Command failed with status (2): [make...]

Unable to build on Mac OS 10.11.6

Tried building on 2 different macs, both running 10.11.6.
Im not a rubyist, so I have no idea what the problem here is, but it looks like maybe an issue with the version of rice or boost?

Using ruby install from homebrew

$ which ruby
/usr/local/bin/ruby
$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]

Rice is up to date

$ gem list rice

*** LOCAL GEMS ***

rice (2.1.0)

Boost install from homebrew

$ brew info boost
boost: stable 1.61.0 (bottled), HEAD
Collection of portable C++ source libraries
https://www.boost.org/
/usr/local/Cellar/boost/1.61.0_1 (12,259 files, 438.4M) *
  Poured from bottle on 2016-08-15 at 09:48:29
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/boost.rb

Install log

$ gem install mapnik
Building native extensions.  This could take a while...
ERROR:  Error installing mapnik:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.3.0/gems/mapnik-0.2.0/ext/ruby_mapnik
/usr/local/opt/ruby/bin/ruby -r ./siteconf20160921-22405-6u0135.rb extconf.rb
creating Makefile

current directory: /usr/local/lib/ruby/gems/2.3.0/gems/mapnik-0.2.0/ext/ruby_mapnik
make "DESTDIR=" clean

current directory: /usr/local/lib/ruby/gems/2.3.0/gems/mapnik-0.2.0/ext/ruby_mapnik
make "DESTDIR="
compiling _mapnik.cpp
In file included from _mapnik.cpp:22:
In file included from ./_mapnik.h:26:
In file included from /usr/local/lib/ruby/gems/2.3.0/gems/rice-2.1.0/ruby/lib/include/rice/Enum.hpp:7:
In file included from /usr/local/lib/ruby/gems/2.3.0/gems/rice-2.1.0/ruby/lib/include/rice/Hash.hpp:224:
/usr/local/lib/ruby/gems/2.3.0/gems/rice-2.1.0/ruby/lib/include/rice/Hash.ipp:106:25: warning: declaration shadows a field of 'Rice::Hash::Entry' [-Wshadow]
Entry(Hash hash, Object key)
                        ^
/usr/local/lib/ruby/gems/2.3.0/gems/rice-2.1.0/ruby/lib/include/rice/Hash.hpp:131:16: note: previous declaration is here
  Object const key;          //!< The key
               ^
In file included from _mapnik.cpp:22:
In file included from ./_mapnik.h:26:
In file included from /usr/local/lib/ruby/gems/2.3.0/gems/rice-2.1.0/ruby/lib/include/rice/Enum.hpp:7:
In file included from /usr/local/lib/ruby/gems/2.3.0/gems/rice-2.1.0/ruby/lib/include/rice/Hash.hpp:224:
/usr/local/lib/ruby/gems/2.3.0/gems/rice-2.1.0/ruby/lib/include/rice/Hash.ipp:295:26: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
  return iterator(*this, size());
         ~~~~~~~~        ^~~~~~
/usr/local/lib/ruby/gems/2.3.0/gems/rice-2.1.0/ruby/lib/include/rice/Hash.ipp:301:32: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
  return const_iterator(*this, size());
         ~~~~~~~~~~~~~~        ^~~~~~
3 warnings generated.
compiling _mapnik_color.rb.cpp
compiling _mapnik_coord.rb.cpp
compiling _mapnik_datasource.rb.cpp
In file included from _mapnik_datasource.rb.cpp:28:
In file included from /usr/local/lib/ruby/gems/2.3.0/gems/rice-2.1.0/ruby/lib/include/rice/Hash.hpp:224:
/usr/local/lib/ruby/gems/2.3.0/gems/rice-2.1.0/ruby/lib/include/rice/Hash.ipp:106:25: warning: declaration shadows a field of 'Rice::Hash::Entry' [-Wshadow]
Entry(Hash hash, Object key)
                        ^
/usr/local/lib/ruby/gems/2.3.0/gems/rice-2.1.0/ruby/lib/include/rice/Hash.hpp:131:16: note: previous declaration is here
  Object const key;          //!< The key
               ^
In file included from _mapnik_datasource.rb.cpp:28:
In file included from /usr/local/lib/ruby/gems/2.3.0/gems/rice-2.1.0/ruby/lib/include/rice/Hash.hpp:224:
/usr/local/lib/ruby/gems/2.3.0/gems/rice-2.1.0/ruby/lib/include/rice/Hash.ipp:295:26: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
  return iterator(*this, size());
         ~~~~~~~~        ^~~~~~
/usr/local/lib/ruby/gems/2.3.0/gems/rice-2.1.0/ruby/lib/include/rice/Hash.ipp:301:32: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
  return const_iterator(*this, size());
         ~~~~~~~~~~~~~~        ^~~~~~
_mapnik_datasource.rb.cpp:46:54: error: no template named 'static_visitor' in namespace 'boost'; did you mean 'mapnik::util::static_visitor'?
  class mapnik_value_holder_to_ruby_visitor : public boost::static_visitor<Rice::Object>
                                                     ^~~~~~~~~~~~~~~~~~~~~
                                                     mapnik::util::static_visitor
/usr/local/include/mapnik/util/variant.hpp:67:8: note: 'mapnik::util::static_visitor' declared here
struct static_visitor
       ^
_mapnik_datasource.rb.cpp:73:20: error: no template named 'shared_ptr' in namespace 'boost'; did you mean 'std::shared_ptr'?
  std::string name(boost::shared_ptr<mapnik::datasource> self){
                   ^~~~~~~~~~~~~~~~~
                   std::shared_ptr
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4127:61: note: 'std::shared_ptr' declared here
    template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY shared_ptr;
                                                            ^
_mapnik_datasource.rb.cpp:78:3: error: no template named 'shared_ptr' in namespace 'boost'; did you mean 'std::shared_ptr'?
  boost::shared_ptr<mapnik::datasource> create(Rice::Object params){
  ^~~~~~~~~~~~~~~~~
  std::shared_ptr
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4127:61: note: 'std::shared_ptr' declared here
    template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY shared_ptr;
                                                            ^
_mapnik_datasource.rb.cpp:110:49: error: no template named 'shared_ptr' in namespace 'boost'; did you mean 'std::shared_ptr'?
  mapnik::box2d<double> get_datasource_envelope(boost::shared_ptr<mapnik::datasource> self){
                                                ^~~~~~~~~~~~~~~~~
                                                std::shared_ptr
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4127:61: note: 'std::shared_ptr' declared here
    template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY shared_ptr;
                                                            ^
_mapnik_datasource.rb.cpp:114:38: error: no template named 'shared_ptr' in namespace 'boost'; did you mean 'std::shared_ptr'?
  Rice::Object get_datasource_params(boost::shared_ptr<mapnik::datasource> const & self){
                                     ^~~~~~~~~~~~~~~~~
                                     std::shared_ptr
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4127:61: note: 'std::shared_ptr' declared here
    template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY shared_ptr;
                                                            ^
_mapnik_datasource.rb.cpp:120:42: error: no member named 'apply_visitor' in namespace 'boost'; did you mean 'mapnik::util::apply_visitor'?
      params[Rice::Symbol(pos->first)] = boost::apply_visitor(mapnik_value_holder_to_ruby_visitor(), pos->second);
                                         ^~~~~~~~~~~~~~~~~~~~
                                         mapnik::util::apply_visitor
/usr/local/include/mapnik/util/variant.hpp:877:28: note: 'mapnik::util::apply_visitor' declared here
auto VARIANT_INLINE static apply_visitor(F f, V const& v) -> decltype(V::visit(v, f))
                           ^
_mapnik_datasource.rb.cpp:130:20: error: no template named 'shared_ptr' in namespace 'boost'; did you mean 'std::shared_ptr'?
  Rice::Data_Type< boost::shared_ptr<mapnik::datasource> > rb_cdatasource = Rice::define_class_under< boost::shared_ptr<mapnik::datasource> >(rb_mapnik, "Datasource");
                   ^~~~~~~~~~~~~~~~~
                   std::shared_ptr
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4127:61: note: 'std::shared_ptr' declared here
    template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY shared_ptr;
                                                            ^
_mapnik_datasource.rb.cpp:130:103: error: no template named 'shared_ptr' in namespace 'boost'; did you mean 'std::shared_ptr'?
  Rice::Data_Type< boost::shared_ptr<mapnik::datasource> > rb_cdatasource = Rice::define_class_under< boost::shared_ptr<mapnik::datasource> >(rb_mapnik, "Datasource");
                                                                                                      ^~~~~~~~~~~~~~~~~
                                                                                                      std::shared_ptr
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4127:61: note: 'std::shared_ptr' declared here
    template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY shared_ptr;
                                                            ^
3 warnings and 8 errors generated.
make: *** [_mapnik_datasource.rb.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.3.0/gems/mapnik-0.2.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0/mapnik-0.2.0/gem_make.out

fix handling of long long

lots of compiler warnings currently against mapnik v2.2.0 due to poor handling of the new 64bit long long type of mapnik::value_integer. This needs work, but was over my head at the time given my lack of ruby/rice experience. Hoping @elliotlaster can take a look.

Segfault running tests on OS X

$ ruby -v
ruby 2.0.0p451 (2014-02-24 revision 45167) [universal.x86_64-darwin13]
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff90e4e866 __pthread_kill + 10
1   libsystem_pthread.dylib         0x00007fff92ae835c pthread_kill + 92
2   libsystem_c.dylib               0x00007fff88993b1a abort + 125
3   libruby.2.0.0.dylib             0x000000010d5f6d19 rb_bug + 184
4   libruby.2.0.0.dylib             0x000000010d68be9e 0x10d5cd000 + 781982
5   libsystem_platform.dylib        0x00007fff8eaaa5aa _sigtramp + 26
6   ???                             000000000000000000 0 + 0
7   ruby_mapnik.bundle              0x000000010dd20fe4 std::_Rb_tree<Rice::Data_Type<void>*, Rice::Data_Type<void>*, std::_Identity<Rice::Data_Type<void>*>, std::less<Rice::Data_Type<void>*>, std::allocator<Rice::Data_Type<void>*> >::_M_insert_unique(Rice::Data_Type<void>* const&) + 100 (stl_tree.h:200)
8   ruby_mapnik.bundle              0x000000010dd20f57 Rice::Data_Type<void>::Data_Type() + 231 (Data_Type_defn.hpp:77)
9   ruby_mapnik.bundle              0x000000010dd22c9a Rice::Data_Type<mapnik::color> Rice::Data_Type<mapnik::color>::bind<void>(Rice::Module const&) + 602 (Data_Type.ipp:91)
10  ruby_mapnik.bundle              0x000000010dd1ebdb Rice::Data_Type<mapnik::color> Rice::define_class_under<mapnik::color>(Rice::Object, char const*) + 91 (Module_impl.hpp:20)
11  ruby_mapnik.bundle              0x000000010dd1de2b register_color(Rice::Module) + 75 (_mapnik_color.rb.cpp:84)
12  ruby_mapnik.bundle              0x000000010dd1caf2 register_mapnik() + 130 (Module_impl.hpp:20)
13  ruby_mapnik.bundle              0x000000010ddfdb3d Init_ruby_mapnik + 61 (ruby_mapnik.cpp:30)
14  libruby.2.0.0.dylib             0x000000010d5cdcde dln_load + 186
$ gem list

*** LOCAL GEMS ***

addressable (2.3.6, 2.3.5)
backports (3.6.0)
bigdecimal (1.2.5, 1.2.0)
blankslate (3.1.3, 3.1.2, 2.1.2.4)
cairo (1.12.9)
celluloid (0.15.2)
CFPropertyList (2.2.8, 2.2.0)
chunky_png (1.3.1)
classifier (1.3.4)
coderay (1.1.0)
coffee-script (2.2.0)
coffee-script-source (1.7.0)
colorator (0.1)
colored (1.2)
commander (4.2.0, 4.1.6)
diff-lcs (1.2.5)
ethon (0.7.1, 0.7.0, 0.6.3)
execjs (2.2.1, 2.1.0)
faraday (0.9.0, 0.8.9)
faraday_middleware (0.9.1, 0.9.0)
fast-stemmer (1.0.2)
ffi (1.9.3)
gh (0.13.2)
git-up (0.5.12)
grit (2.5.0)
highline (1.6.21)
hitimes (1.2.1)
hoe (3.12.0)
io-console (0.4.2)
jekyll (2.1.0, 2.0.3, 1.5.1, 1.4.3)
jekyll-coffeescript (1.0.0)
jekyll-gist (1.1.0)
jekyll-paginate (1.0.0)
jekyll-sass-converter (1.0.0)
jekyll-watch (1.0.0)
json (1.8.1, 1.7.7)
kramdown (1.4.0, 1.3.3)
launchy (2.4.2)
libxml-ruby (2.7.0, 2.6.0)
liquid (2.6.1, 2.5.5)
listen (2.7.9, 2.7.5, 1.3.1)
maruku (0.7.2, 0.7.1, 0.7.0)
mercenary (0.3.3)
method_source (0.8.2)
mime-types (2.3, 1.25.1)
mini_portile (0.6.0)
minitest (5.3.5, 5.3.4, 4.3.2)
multi_json (1.10.1, 1.9.0)
multipart-post (2.0.0, 1.2.0)
net-http-persistent (2.9.4)
net-http-pipeline (1.0.1)
nokogiri (1.6.2.1, 1.5.6)
parslet (1.6.1, 1.5.0)
pkg-config (1.1.5)
posix-spawn (0.3.8)
pry (0.10.0, 0.9.12.6)
psych (2.0.5, 2.0.0)
pusher-client (0.6.0, 0.4.0)
pygments.rb (0.6.0, 0.5.4)
rake (10.3.2, 0.9.6)
rake-compiler (0.9.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5, 0.9.4, 0.9.3)
rb-kqueue (0.2.3, 0.2.2)
rdiscount (2.1.7.1, 2.1.7)
rdoc (4.1.1, 4.0.0)
redcarpet (3.1.2, 2.3.0)
rice (1.6.2)
safe_yaml (1.0.3, 1.0.2, 0.9.7)
sass (3.3.9, 3.3.7)
slop (3.5.0, 3.4.7)
sqlite3 (1.3.9, 1.3.7)
test-unit (2.5.5, 2.0.0.0)
timers (3.0.1, 1.1.0)
toml (0.1.1)
travis (1.6.14, 1.6.11, 1.6.8, 1.6.7)
typhoeus (0.6.9, 0.6.8, 0.6.7)
websocket (1.1.4, 1.0.7)
yajl-ruby (1.2.1, 1.2.0, 1.1.0)

Failed install ‘get_force_odd_labels’ is not a member of ‘mapnik::text_symbolizer’

Ubuntu 14.04

mapnik-config -v gives 2.3.0-pre

I installed following gems: rake-compiler rake hoe rice chunky_png cairo.

rake fails:

Defaulting gemspec to MIT license.
Call license in hoe spec to change.
cd tmp/i686-linux/ruby_mapnik/1.9.3
make
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp: In function ‘Rice::Object {anonymous}::get_text_displacement(const mapnik::text_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp:37:47: warning: ‘const position& mapnik::text_symbolizer::get_displacement() const’ is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:118) [-Wdeprecated-declarations]
mapnik::position pos = t.get_displacement();
^
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::horizontal_alignment {anonymous}::get_text_horizontal_alignment(const mapnik::text_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp:52:76: warning: ‘mapnik::horizontal_alignment_e mapnik::text_symbolizer::get_horizontal_alignment() const’ is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:134) [-Wdeprecated-declarations]
mapnik::horizontal_alignment alignment = self.get_horizontal_alignment();
^
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::justify_alignment {anonymous}::get_text_justify_alignment(const mapnik::text_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp:61:70: warning: ‘mapnik::justify_alignment_e mapnik::text_symbolizer::get_justify_alignment() const’ is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:136) [-Wdeprecated-declarations]
mapnik::justify_alignment alignment = self.get_justify_alignment();
^
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::label_placement_enum {anonymous}::get_text_label_placement(const mapnik::text_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp:70:71: warning: ‘mapnik::label_placement_e mapnik::text_symbolizer::get_label_placement() const’ is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:113) [-Wdeprecated-declarations]
mapnik::label_placement_enum alignment = self.get_label_placement();
^
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::text_transform {anonymous}::get_text_transform(const mapnik::text_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp:79:64: warning: ‘mapnik::text_transform_e mapnik::text_symbolizer::get_text_transform() const’ is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:86) [-Wdeprecated-declarations]
mapnik::text_transform transform = self.get_text_transform();
^
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::vertical_alignment {anonymous}::get_vertical_alignment(const mapnik::text_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp:88:72: warning: ‘mapnik::vertical_alignment_e mapnik::text_symbolizer::get_vertical_alignment() const’ is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:115) [-Wdeprecated-declarations]
mapnik::vertical_alignment transform = self.get_vertical_alignment();
^
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp: In function ‘void register_text_symbolizer(Rice::Module)’:
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp:240:59: error: ‘get_force_odd_labels’ is not a member of ‘mapnik::text_symbolizer’
rb_ctext_symbolizer.define_method("force_odd_labels?", &mapnik::text_symbolizer::get_force_odd_labels);
^
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp:249:59: error: ‘set_force_odd_labels’ is not a member of ‘mapnik::text_symbolizer’
rb_ctext_symbolizer.define_method("force_odd_labels=", &mapnik::text_symbolizer::set_force_odd_labels);
^
make: *** [_mapnik_text_symbolizer.rb.o] Error 1
rake aborted!
Command failed with status (2): [make...]

Tasks: TOP => default => test => compile => compile:i686-linux => compile:ruby_mapnik:i686-linux => copy:ruby_mapnik:i686-linux:1.9.3 => tmp/i686-linux/ruby_mapnik/1.9.3/ruby_mapnik.so
(See full trace by running task with --trace)

unable to convert "\xA9" from ASCII-8BIT to UTF-8 for demo/data/COPYRIGHT.txt, skipping

mateusz@Grisznak:~/Desktop/tmp/Ruby-Mapnik$ gem install pkg/ruby_mapnik-0.1.5.gem
Building native extensions.  This could take a while...
Successfully installed ruby_mapnik-0.1.5
1 gem installed
Installing ri documentation for ruby_mapnik-0.1.5...
unable to convert "\xA9" from ASCII-8BIT to UTF-8 for demo/data/COPYRIGHT.txt, skipping
Installing RDoc documentation for ruby_mapnik-0.1.5...
unable to convert "\xA9" from ASCII-8BIT to UTF-8 for demo/data/COPYRIGHT.txt, skipping

Rhomobile

Hi all,
I need an advice. Is it possible with Ruby-Mapnik to add it to the Rhomobile framework as extension and generate tiles on the fly?

Create a 0.1.6 release?

It would be great to create a 0.1.4 release with the code that we have already here. I have another project, mapnik-legendary which I'd like to release on rubygems, but it needs some functionality that's only in the master branch and not yet in any releases.

private members not available to class?

running ruby 1.9.2 on ubuntu and seeing:

$ ruby-1.9.2-p290 rundemo.rb 
/home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/rule.rb:98:in `symbols': undefined local variable or method `__symbols__' for #<Mapnik::Rule:0x0000000227e758> (NameError)
    from /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/rule.rb:79:in `fill='
    from rundemo.rb:17:in `block (4 levels) in <main>'
    from /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/style.rb:52:in `rule'
    from rundemo.rb:16:in `block (3 levels) in <main>'
    from /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/layer.rb:54:in `style'
    from rundemo.rb:15:in `block (2 levels) in <main>'
    from /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik/mapnik/map.rb:138:in `layer'
    from rundemo.rb:13:in `block in <main>'
    from rundemo.rb:4:in `initialize'
    from rundemo.rb:4:in `new'
    from rundemo.rb:4:in `<main>'

expose mapnik::context_ptr

Features, to be constructed, need at context_ptr now as first argument. I allowed for a compile in 6f5bb88 but still needs a context_ptr exposed to be able to create a feature at runtime.

query support

Is there any plan to add support for querying for features from mapnik for this api?

Or how about being able to turn pixel x,y from a tile request into actual map projection coordinates?

gem install fails on ubuntu

$ gem-ruby-1.9.2-p290 install ruby_mapnik
Fetching: rice-1.4.2.gem (100%)
Building native extensions.  This could take a while...
Fetching: ruby_mapnik-0.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing ruby_mapnik:
    ERROR: Failed to build gem native extension.

        /home/mapnik/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for main() in -lrice... yes
creating Makefile

make
g++ -I. -I/home/mapnik/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/x86_64-linux -I/home/mapnik/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/home/mapnik/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I.    -I/home/mapnik/.rvm/gems/ruby-1.9.2-p290/gems/rice-1.4.2/ruby/lib/include -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long  -fPIC-I/usr/include -I/usr/include -I/usr/include/freetype2 -I/usr/include/libxml2 -I/usr/include/postgresql -I/usr/include/gdal -DHAVE_JPEG -DBOOST_REGEX_HAS_ICU -ansi -Wall -pthread -ftemplate-depth-300 -DLINUX -DBOOST_SPIRIT_THREADSAFE -DMAPNIK_THREADSAFE -O3 -finline-functions -Wno-inline -DNDEBUG -DHAVE_CAIRO -DLIBTOOL_SUPPORTS_ADVISE -DHAVE_LIBXML2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libpng12 -I/usr/include/cairomm-1.0 -I/usr/lib/cairomm-1.0/include -I/usr/include/cairo -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/pixman-1  -Wall -g -o ruby_mapnik.o -c ruby_mapnik.cpp
cc1plus: error: unrecognized command line option "-fPIC-I/usr/include"

segfault in test of shield_symbolizer

_mapnik_shield_symbolizer.rb:141: [BUG] Segmentation fault
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff8a07082a __kill + 10
1   libsystem_c.dylib               0x00007fff88f5da9c abort + 177
2   libruby.1.dylib                 0x0000000101df3649 rb_bug + 316
3   libruby.1.dylib                 0x0000000101e5ad8c 0x101de0000 + 503180
4   libsystem_c.dylib               0x00007fff88fbecfa _sigtramp + 26
5   libmapnik.dylib                 0x000000010264acb5 mapnik::to_expression_string(boost::variant<mapnik::value, mapnik::attribute, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::plus> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::minus> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::mult> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::div> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::mod> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::less> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::less_equal> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::greater> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::greater_equal> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::equal_to> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::not_equal_to> >, boost::recursive_wrapper<mapnik::unary_node<mapnik::tags::logical_not> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::logical_and> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::logical_or> >, boost::recursive_wrapper<mapnik::regex_match_node>, boost::recursive_wrapper<mapnik::regex_replace_node>, boost::detail::variant::void_, boost::detail::variant::void_> const&) + 37
6   ruby_mapnik.bundle              0x00000001021d7114 (anonymous namespace)::expr_node_to_string_(boost::shared_ptr<boost::variant<mapnik::value, mapnik::attribute, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::plus> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::minus> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::mult> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::div> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::mod> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::less> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::less_equal> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::greater> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::greater_equal> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::equal_to> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::not_equal_to> >, boost::recursive_wrapper<mapnik::unary_node<mapnik::tags::logical_not> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::logical_and> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::logical_or> >, boost::recursive_wrapper<mapnik::regex_match_node>, boost::recursive_wrapper<mapnik::regex_replace_node>, boost::detail::variant::void_, boost::detail::variant::void_> >) + 20 (_mapnik_expression.rb.cpp:45)
7   ruby_mapnik.bundle              0x00000001021d976d Rice::detail::Auto_Function_Wrapper<std::string (*)(boost::shared_ptr<boost::variant<mapnik::value, mapnik::attribute, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::plus> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::minus> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::mult> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::div> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::mod> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::less> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::less_equal> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::greater> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::greater_equal> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::equal_to> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::not_equal_to> >, boost::recursive_wrapper<mapnik::unary_node<mapnik::tags::logical_not> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::logical_and> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::logical_or> >, boost::recursive_wrapper<mapnik::regex_match_node>, boost::recursive_wrapper<mapnik::regex_replace_node>, boost::detail::variant::void_, boost::detail::variant::void_> >), std::string, boost::shared_ptr<boost::variant<mapnik::value, mapnik::attribute, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::plus> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::minus> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::mult> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::div> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::mod> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::less> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::less_equal> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::greater> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::greater_equal> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::equal_to> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::not_equal_to> >, boost::recursive_wrapper<mapnik::unary_node<mapnik::tags::logical_not> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::logical_and> >, boost::recursive_wrapper<mapnik::binary_node<mapnik::tags::logical_or> >, boost::recursive_wrapper<mapnik::regex_match_node>, boost::recursive_wrapper<mapnik::regex_replace_node>, boost::detail::variant::void_, boost::detail::variant::void_> >, void, void, void, void, void, void, void, void, void, void, void, void, void, void, void>::call(int, unsigned long*, unsigned long) + 365 (basic_string.h:279)

Build failure because of rice/Allocation_Strategies.hpp

g++ -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I.    -I/home/zverik/.gem/ruby/gems/rice-1.6.2/ruby/lib/include -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=generic -fPIC -I/usr/include -I/usr/include/polyclipping -I/usr/include/agg2 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libxml2 -I/usr/include/gdal -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/libpng16 -DHAVE_JPEG -DMAPNIK_USE_PROJ4 -DHAVE_PNG -DHAVE_TIFF -DBIGINT -DBOOST_REGEX_HAS_ICU -DLINUX -DMAPNIK_THREADSAFE -DNDEBUG -DHAVE_CAIRO -DHAVE_LIBXML2 -ansi -Wall -pthread -ftemplate-depth-300 -O3 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts  -m64  -Wall -g -o _mapnik_feature.rb.o -c _mapnik_feature.rb.cpp
g++ -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I.    -I/home/zverik/.gem/ruby/gems/rice-1.6.2/ruby/lib/include -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=generic -fPIC -I/usr/include -I/usr/include/polyclipping -I/usr/include/agg2 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libxml2 -I/usr/include/gdal -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/libpng16 -DHAVE_JPEG -DMAPNIK_USE_PROJ4 -DHAVE_PNG -DHAVE_TIFF -DBIGINT -DBOOST_REGEX_HAS_ICU -DLINUX -DMAPNIK_THREADSAFE -DNDEBUG -DHAVE_CAIRO -DHAVE_LIBXML2 -ansi -Wall -pthread -ftemplate-depth-300 -O3 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts  -m64  -Wall -g -o ruby_mapnik.o -c ruby_mapnik.cpp
In file included from ruby_mapnik.cpp:23:0:
_mapnik.h:30:42: fatal error: rice/Allocation_Strategies.hpp: No such file or directory
 #include <rice/Allocation_Strategies.hpp>

The file is present in older rice repositories, but not in the latest version.

Ruby 2.0 build warnings

~/projects/ruby-mapnik[master]$ make
rake compile
mkdir -p tmp/x86_64-darwin12.3.0/ruby_mapnik/2.0.0
cd tmp/x86_64-darwin12.3.0/ruby_mapnik/2.0.0
/usr/local/Cellar/ruby/2.0.0-p195/bin/ruby -I. ../../../../ext/ruby_mapnik/extconf.rb
../../../../ext/ruby_mapnik/extconf.rb:38:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
../../../../ext/ruby_mapnik/extconf.rb:38:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
../../../../ext/ruby_mapnik/extconf.rb:39:in `<main>': Use RbConfig instead of obsolete and deprecated Config.

rundemo require error

$ cd demo/
$ ruby-1.9.2-p290 rundemo.rb 
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- ruby_mapnik_config (LoadError)
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from /home/mapnik/src/Ruby-Mapnik/lib/ruby_mapnik.rb:26:in `<top (required)>'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from rundemo.rb:2:in `<main>'

Fedora 17 compiling issues

Hi,

I'm running Fedora 17 (3.6.7-4.fc17.x86_64) and the Ruby-Mapnik gem does not compile, I get the following errors:

gem install ruby_mapnik
Fetching: ruby_mapnik-0.1.5.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing ruby_mapnik:
ERROR: Failed to build gem native extension.

    /home/jason/.rbenv/versions/1.9.3-p194/bin/ruby extconf.rb

checking for main() in -lrice... yes
creating Makefile

make
compiling _mapnik_raster_colorizer.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_symbolizer.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_datasource_cache.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
_mapnik_datasource_cache.rb.cpp: In function ‘bool {anonymous}::rubysafe_register_sources(std::string)’:
_mapnik_datasource_cache.rb.cpp:37:41: error: base operand of ‘->’ has non-pointer type ‘mapnik::datasource_cache’
_mapnik_datasource_cache.rb.cpp: In function ‘Rice::Array {anonymous}::rubysafe_plugin_names()’:
_mapnik_datasource_cache.rb.cpp:42:104: error: base operand of ‘->’ has non-pointer type ‘mapnik::datasource_cache’
make: *** [_mapnik_datasource_cache.rb.o] Error 1

So I tried to compile the gem from the git repository using rake but it too has a compile error:

compiling ../../../../ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp
../../../../ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp: In function ‘const string {anonymous}::get_filename(const mapnik::markers_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp:34:22: error: ‘mapnik::path_processor_type’ has not been declared
../../../../ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp: In function ‘void {anonymous}::set_filename(mapnik::markers_symbolizer&, const string&)’:
../../../../ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp:38:22: error: ‘parse_path’ is not a member of ‘mapnik’
../../../../ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp: In function ‘const string {anonymous}::get_filename(const mapnik::markers_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp:35:3: warning: control reaches end of non-void function [-Wreturn-type]
gmake: *** [_mapnik_markers_symbolizer.rb.o] Error 1
rake aborted!
Command failed with status (2): [gmake...]

Thanks,

Jason

Error installing ruby_mapnik gem

Hello,

I'm getting the follow error while trying to install ruby_mapnik as a gem:

_mapnik_geometry.rb.cpp:81:41: error: ‘area’ is not a member of ‘mapnik::geometry_type’

I also try with git repository and got the same error.

I'm using last mapnik from source.

Regards

Failing tests on Ubuntu 14.04 with Mapnik 2.3.0-pre and ruby 1.9.3p484 (2013-11-22 revision 43786) [i686-linux]

Versions obtained with mapnik-config -v and ruby -v

rake test gives

mateusz@Grisznak:~/Desktop/tmp/Ruby-Mapnik$ rake test
Defaulting gemspec to MIT license.
Call license in hoe spec to change.
install -c tmp/i686-linux/ruby_mapnik/1.9.3/ruby_mapnik.so lib/ruby_mapnik/ruby_mapnik.so
cp tmp/i686-linux/ruby_mapnik/1.9.3/ruby_mapnik.so tmp/i686-linux/stage/lib/ruby_mapnik/ruby_mapnik.so
/usr/bin/ruby1.9.1 -w -Ilib:bin:test:. -e 'require "rubygems"; require "minitest/autorun"; require "test/test_mapnik_envelope.rb"; require "test/test_mapnik_font_engine.rb"; require "test/test_mapnik_map.rb"; require "test/test_mapnik_line_symbolizer.rb"; require "test/test_mapnik_color.rb"; require "test/test_mapnik_layer.rb"; require "test/test_mapnik_raster_colorizer.rb"; require "test/test_mapnik_projection.rb"; require "test/test_mapnik_datasource.rb"; require "test/test_mapnik_style.rb"; require "test/test_mapnik_point_symbolizer.rb"; require "test/test_mapnik_text_symbolizer.rb"; require "test/test_mapnik_rule.rb"; require "test/test_mapnik_stroke.rb"; require "test/test_mapnik_polygon_symbolizer.rb"; require "test/test_mapnik_feature.rb"; require "test/test_mapnik_shield_symbolizer.rb"; require "test/test_mapnik_symbolizer.rb"; require "test/test_polygon_pattern_symbolizer.rb"; require "test/test_line_pattern_symbolizer.rb"; require "test/test_mapnik_raster_symbolizer.rb"; require "test/test_mapnik_coord.rb"; require "test/test_ruby_mapnik.rb"; require "test/test_helper.rb"; require "test/test_mapnik_expression.rb"; require "test/test_mapnik_markers_symbolizer.rb"' -- 
/home/mateusz/Desktop/tmp/Ruby-Mapnik/lib/ruby_mapnik/ruby_mapnik.so: warning: method redefined; discarding old initialize
/home/mateusz/Desktop/tmp/Ruby-Mapnik/lib/ruby_mapnik/ruby_mapnik.so: warning: method redefined; discarding old initialize
/home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_map.rb:58: warning: assigned but unused variable - scale_before
/home/mateusz/.gem/ruby/1.9.1/gems/chunky_png-1.3.4/lib/chunky_png/color.rb:592: warning: assigned but unused variable - min
/home/mateusz/.gem/ruby/1.9.1/gems/chunky_png-1.3.4/lib/chunky_png/canvas/png_decoding.rb:395: warning: assigned but unused variable - line_no
/home/mateusz/.gem/ruby/1.9.1/gems/chunky_png-1.3.4/lib/chunky_png/canvas/operations.rb:269: warning: assigned but unused variable - rotated
/home/mateusz/.gem/ruby/1.9.1/gems/chunky_png-1.3.4/lib/chunky_png/canvas/drawing.rb:302: warning: shadowing outer local variable - y
/home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_layer.rb:10: warning: assigned but unused variable - layer
/home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_layer.rb:34: warning: assigned but unused variable - srs_before
Run options: --seed 16667

# Running tests:

..........................................EEEE................................EE....................................Mapnik LOG> 2015-05-14 10:51:34: setting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: converting 'mode=normal' to 'comp-op:src_over'
Mapnik LOG> 2015-05-14 10:51:34: getting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: setting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: could not convert mode 'grain_merge' into comp-op, defaulting to 'comp-op:src-over'
Mapnik LOG> 2015-05-14 10:51:34: getting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: setting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: could not convert mode 'grain_merge2' into comp-op, defaulting to 'comp-op:src-over'
Mapnik LOG> 2015-05-14 10:51:34: getting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: setting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: converting 'mode:multiply' to 'comp-op:multiply'
Mapnik LOG> 2015-05-14 10:51:34: getting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: setting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: converting 'mode:multiply2' to 'comp-op:multiply'
Mapnik LOG> 2015-05-14 10:51:34: getting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: setting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: could not convert mode 'divide' into comp-op, defaulting to 'comp-op:src-over'
Mapnik LOG> 2015-05-14 10:51:34: getting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: setting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: could not convert mode 'divide2' into comp-op, defaulting to 'comp-op:src-over'
Mapnik LOG> 2015-05-14 10:51:34: getting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: setting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: converting 'mode:screen' to 'comp-op:screen'
Mapnik LOG> 2015-05-14 10:51:34: getting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: setting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
Mapnik LOG> 2015-05-14 10:51:34: could not convert mode 'hard_light' into comp-op, defaulting to 'comp-op:src-over'
Mapnik LOG> 2015-05-14 10:51:34: getting 'mode' is deprecated and will be removed in Mapnik 3.x, use 'comp-op' with Mapnik >= 2.1.x
...............E......................................E................................

Finished tests in 0.154009s, 1318.1036 tests/s, 3097.2187 assertions/s.

  1) Error:
test_should_add_a_geometry(TestMapnikFeature):
ArgumentError: Unable to convert Fixnum to long long
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_feature.rb:23:in `initialize'
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_feature.rb:23:in `new'
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_feature.rb:23:in `test_should_add_a_geometry'

  2) Error:
test_should_instantiate(TestMapnikFeature):
ArgumentError: Unable to convert Fixnum to long long
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_feature.rb:7:in `initialize'
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_feature.rb:7:in `new'
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_feature.rb:7:in `test_should_instantiate'

  3) Error:
test_should_return_its_envelope(TestMapnikFeature):
ArgumentError: Unable to convert Fixnum to long long
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_feature.rb:18:in `initialize'
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_feature.rb:18:in `new'
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_feature.rb:18:in `test_should_return_its_envelope'

  4) Error:
test_should_return_number_of_geometries(TestMapnikFeature):
ArgumentError: Unable to convert Fixnum to long long
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_feature.rb:13:in `initialize'
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_feature.rb:13:in `new'
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_feature.rb:13:in `test_should_return_number_of_geometries'

  5) Error:
test_should_load_from_file(TestMapnikMap):
ArgumentError: Unable to convert  to mapnik::Map*
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/lib/ruby_mapnik/mapnik/map.rb:107:in `__load_map__'
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/lib/ruby_mapnik/mapnik/map.rb:107:in `from_file'
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_map.rb:182:in `test_should_load_from_file'

  6) Error:
test_should_load_from_file_path_string(TestMapnikMap):
ArgumentError: Unable to convert  to mapnik::Map*
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/lib/ruby_mapnik/mapnik/map.rb:107:in `__load_map__'
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/lib/ruby_mapnik/mapnik/map.rb:107:in `from_file'
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_map.rb:175:in `test_should_load_from_file_path_string'

  7) Error:
test_should_get_and_set_force_odd_labels(TestMapnikShieldSymbolizer):
NoMethodError: undefined method `force_odd_labels=' for #<Mapnik::ShieldSymbolizer:0x8b9f778>
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_shield_symbolizer.rb:70:in `test_should_get_and_set_force_odd_labels'

  8) Error:
test_should_get_and_set_force_odd_labels(TestMapnikTextSymbolizer):
NoMethodError: undefined method `force_odd_labels=' for #<Mapnik::TextSymbolizer:0x8bf5588>
    /home/mateusz/Desktop/tmp/Ruby-Mapnik/test/test_mapnik_text_symbolizer.rb:85:in `test_should_get_and_set_force_odd_labels'

203 tests, 477 assertions, 0 failures, 8 errors, 0 skips
rake aborted!
Command failed with status (1): [/usr/bin/ruby1.9.1 -w -Ilib:bin:test:. -e ...]
/home/mateusz/.gem/ruby/1.9.1/gems/hoe-3.13.1/lib/hoe/test.rb:83:in `block in define_test_tasks'
Tasks: TOP => test
(See full trace by running task with --trace)

Compiling error on Gentoo

mapnik:2.1.0
ruby: 1.9.3p385

Building native extensions.  This could take a while...
ERROR:  Error installing ruby_mapnik:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby19 extconf.rb
checking for main() in -lrice... yes
creating Makefile

make
compiling _mapnik_text_symbolizer.rb.cpp
_mapnik_text_symbolizer.rb.cpp: In function 'Rice::Object<unnamed>::get_text_displacement(const mapnik::text_symbolizer&)':
_mapnik_text_symbolizer.rb.cpp:37:47: warning: 'const mapnik::position& mapnik::text_symbolizer::get_displacement() const' is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:109)
_mapnik_text_symbolizer.rb.cpp: In function 'mapnik::horizontal_alignment<unnamed>::get_text_horizontal_alignment(const mapnik::text_symbolizer&)':
_mapnik_text_symbolizer.rb.cpp:52:76: warning: 'mapnik::horizontal_alignment_e mapnik::text_symbolizer::get_horizontal_alignment() const' is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:125)
_mapnik_text_symbolizer.rb.cpp: In function 'mapnik::justify_alignment<unnamed>::get_text_justify_alignment(const mapnik::text_symbolizer&)':
_mapnik_text_symbolizer.rb.cpp:61:70: warning: 'mapnik::justify_alignment_e mapnik::text_symbolizer::get_justify_alignment() const' is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:127)
_mapnik_text_symbolizer.rb.cpp: In function 'mapnik::label_placement_enum<unnamed>::get_text_label_placement(const mapnik::text_symbolizer&)':
_mapnik_text_symbolizer.rb.cpp:70:71: warning: 'mapnik::label_placement_e mapnik::text_symbolizer::get_label_placement() const' is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:104)
_mapnik_text_symbolizer.rb.cpp: In function 'mapnik::text_transform<unnamed>::get_text_transform(const mapnik::text_symbolizer&)':
_mapnik_text_symbolizer.rb.cpp:79:64: warning: 'mapnik::text_transform_e mapnik::text_symbolizer::get_text_transform() const' is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:77)
_mapnik_text_symbolizer.rb.cpp: In function 'mapnik::vertical_alignment<unnamed>::get_vertical_alignment(const mapnik::text_symbolizer&)':
_mapnik_text_symbolizer.rb.cpp:88:72: warning: 'mapnik::vertical_alignment_e mapnik::text_symbolizer::get_vertical_alignment() const' is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:106)
compiling _mapnik.cpp
compiling _mapnik_point_symbolizer.rb.cpp
compiling _mapnik_layer.rb.cpp
compiling _mapnik_projection.rb.cpp
compiling _mapnik_font_engine.rb.cpp
compiling _mapnik_datasource_cache.rb.cpp
compiling _mapnik_shield_symbolizer.rb.cpp
compiling _mapnik_datasource.rb.cpp
_mapnik_datasource.rb.cpp: In member function 'Rice::Object<unnamed>::mapnik_value_holder_to_ruby_visitor::operator()(const mapnik::value_null&) const':
_mapnik_datasource.rb.cpp:56:13: warning: passing NULL to non-pointer argument 1 of 'Rice::Object::Object(VALUE)'
compiling _mapnik_polygon_pattern_symbolizer.rb.cpp
compiling _mapnik_stroke.rb.cpp
compiling _mapnik_raster_symbolizer.rb.cpp
compiling _mapnik_coord.rb.cpp
compiling _mapnik_map.rb.cpp
compiling _mapnik_expression.rb.cpp
compiling _mapnik_polygon_symbolizer.rb.cpp
compiling _mapnik_style.rb.cpp
compiling _mapnik_markers_symbolizer.rb.cpp
compiling _mapnik_envelope.rb.cpp
compiling ruby_mapnik.cpp
compiling _mapnik_rule.rb.cpp
compiling _mapnik_raster_colorizer.rb.cpp
compiling _mapnik_line_symbolizer.rb.cpp
compiling _mapnik_line_pattern_symbolizer.rb.cpp
compiling _mapnik_feature.rb.cpp
compiling _mapnik_symbolizer.rb.cpp
compiling _mapnik_color.rb.cpp
linking shared-object ruby_mapnik/ruby_mapnik.so
_mapnik_map.rb.o: In function `render_to_cairo_surface':
/usr/local/lib64/ruby/gems/1.9.1/gems/ruby_mapnik-0.1.5/ext/ruby_mapnik/_mapnik_map.rb.cpp:146: undefined reference to `Cairo::Surface::Surface(_cairo_surface*, bool)'
_mapnik_map.rb.o: In function `render_to_cairo_context':
/usr/local/lib64/ruby/gems/1.9.1/gems/ruby_mapnik-0.1.5/ext/ruby_mapnik/_mapnik_map.rb.cpp:153: undefined reference to `Cairo::Context::Context(_cairo*, bool)'
_mapnik_rule.rb.o: In function `~regex_replace_node':
/usr/include/mapnik/expression_node.hpp:253: undefined reference to `icu_49::UnicodeString::~UnicodeString()'
_mapnik_feature.rb.o: In function `internal_visit<icu_49::UnicodeString>':
/usr/include/boost-1_49/boost/variant/variant.hpp:426: undefined reference to `icu_49::UnicodeString::UnicodeString(icu_49::UnicodeString const&)'
_mapnik_feature.rb.o: In function `to_utf8':
/usr/include/mapnik/value.hpp:57: undefined reference to `u_strToUTF8_49'
/usr/include/mapnik/value.hpp:62: undefined reference to `u_strToUTF8_49'
collect2: ld returned 1 exit status
make: *** [ruby_mapnik.so] Error 1

Compile errors in _mapnik_markers_symbolizer.rb.cpp

Compiling against mapnik v2.1.0-995-gfeaf757 (trunk, March 19th 2013) I get the following errors:

_mapnik_markers_symbolizer.rb.cpp:34:22: error: mapnik::path_processor_type’ has not been declared

and

_mapnik_markers_symbolizer.rb.cpp:38:22: error: ‘parse_path’ is not a member of ‘mapnik’

full log:

andy@eiger:~/src/ruby-mapnik$ rake
mkdir -p tmp/x86_64-linux/ruby_mapnik/1.9.3
cd tmp/x86_64-linux/ruby_mapnik/1.9.3
/usr/bin/ruby1.9.1 -I. ../../../../ext/ruby_mapnik/extconf.rb
checking for main() in -lrice... yes
creating Makefile
cd -
cd tmp/x86_64-linux/ruby_mapnik/1.9.3
make
compiling ../../../../ext/ruby_mapnik/_mapnik_line_symbolizer.rb.cpp
compiling ../../../../ext/ruby_mapnik/_mapnik_datasource_cache.rb.cpp
compiling ../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp: In function ‘Rice::Object {anonymous}::get_text_displacement(const mapnik::text_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp:37:47: warning: ‘const position& mapnik::text_symbolizer::get_displacement() const’ is deprecated (declared at /usr/local/include/mapnik/text_symbolizer.hpp:120) [-Wdeprecated-declarations]
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::horizontal_alignment {anonymous}::get_text_horizontal_alignment(const mapnik::text_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp:52:76: warning: ‘mapnik::horizontal_alignment_e mapnik::text_symbolizer::get_horizontal_alignment() const’ is deprecated (declared at /usr/local/include/mapnik/text_symbolizer.hpp:136) [-Wdeprecated-declarations]
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::justify_alignment {anonymous}::get_text_justify_alignment(const mapnik::text_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp:61:70: warning: ‘mapnik::justify_alignment_e mapnik::text_symbolizer::get_justify_alignment() const’ is deprecated (declared at /usr/local/include/mapnik/text_symbolizer.hpp:138) [-Wdeprecated-declarations]
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::label_placement_enum {anonymous}::get_text_label_placement(const mapnik::text_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp:70:71: warning: ‘mapnik::label_placement_e mapnik::text_symbolizer::get_label_placement() const’ is deprecated (declared at /usr/local/include/mapnik/text_symbolizer.hpp:115) [-Wdeprecated-declarations]
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::text_transform {anonymous}::get_text_transform(const mapnik::text_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp:79:64: warning: ‘mapnik::text_transform_e mapnik::text_symbolizer::get_text_transform() const’ is deprecated (declared at /usr/local/include/mapnik/text_symbolizer.hpp:86) [-Wdeprecated-declarations]
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::vertical_alignment {anonymous}::get_vertical_alignment(const mapnik::text_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp:88:72: warning: ‘mapnik::vertical_alignment_e mapnik::text_symbolizer::get_vertical_alignment() const’ is deprecated (declared at /usr/local/include/mapnik/text_symbolizer.hpp:117) [-Wdeprecated-declarations]
compiling ../../../../ext/ruby_mapnik/ruby_mapnik.cpp
compiling ../../../../ext/ruby_mapnik/_mapnik_polygon_pattern_symbolizer.rb.cpp
compiling ../../../../ext/ruby_mapnik/_mapnik_polygon_symbolizer.rb.cpp
compiling ../../../../ext/ruby_mapnik/_mapnik_stroke.rb.cpp
compiling ../../../../ext/ruby_mapnik/_mapnik_color.rb.cpp
compiling ../../../../ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp
../../../../ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp: In function ‘const string {anonymous}::get_filename(const mapnik::markers_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp:34:22: error: ‘mapnik::path_processor_type’ has not been declared
../../../../ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp: In function ‘void {anonymous}::set_filename(mapnik::markers_symbolizer&, const string&)’:
../../../../ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp:38:22: error: ‘parse_path’ is not a member of ‘mapnik’
../../../../ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp: In function ‘const string {anonymous}::get_filename(const mapnik::markers_symbolizer&)’:
../../../../ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp:35:3: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [_mapnik_markers_symbolizer.rb.o] Error 1
rake aborted!
Command failed with status (2): [make...]
/var/lib/gems/1.9.1/gems/rake-compiler-0.8.3/lib/rake/extensiontask.rb:112:in `block (2 levels) in define_compile_tasks'
/var/lib/gems/1.9.1/gems/rake-compiler-0.8.3/lib/rake/extensiontask.rb:111:in `block in define_compile_tasks'
Tasks: TOP => default => test => compile => compile:x86_64-linux => compile:ruby_mapnik:x86_64-linux => copy:ruby_mapnik:x86_64-linux:1.9.3 => tmp/x86_64-linux/ruby_mapnik/1.9.3/ruby_mapnik.so
(See full trace by running task with --trace)

Compile Failure Ruby 2.1.0

Thanks for a great project. Has made building a ruby tile server very simple.

Keeping on the bleeding edge I tried to build a ruby 2.0.0 ruby_mapnik application to ruby 2.1.0

Got:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

Followed by page after page of:

/Users/gordon/.rbenv/versions/2.1.0/bin/ruby extconf.rb

/Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/ext/builder.rb:89:in `run': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)

Then

sh: fork: Resource temporarily unavailable
/Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/ext/builder.rb:89:in `run': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)

/Users/gordon/.rbenv/versions/2.1.0/bin/ruby extconf.rb

extconf failed, exit code 128

Then page after page of:

Gem files will remain installed in /Users/gordon/Sites/fv/tam/vendor/bundle/gems/cairo-1.12.8 for inspection.
Results logged to /Users/gordon/Sites/fv/tam/vendor/bundle/extensions/x86_64-darwin-13/2.1.0/cairo-1.12.8/gem_make.out
from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:37:in block in build' from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/tempfile.rb:324:inopen'
from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:17:in build' from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/ext/builder.rb:161:inblock (2 levels) in build_extension'
from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in chdir' from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:inblock in build_extension'
from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in synchronize' from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:inbuild_extension'
from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/ext/builder.rb:198:in block in build_extensions' from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:ineach'
from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in build_extensions' from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/specification.rb:1436:inblock in build_extensions'
from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/user_interaction.rb:45:in use_ui' from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/specification.rb:1434:inbuild_extensions'
from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/stub_specification.rb:60:in build_extensions' from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/basic_specification.rb:56:incontains_requirable_file?'
from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/specification.rb:925:in block in find_inactive_by_path' from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/specification.rb:924:ineach'
from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/specification.rb:924:in find' from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/specification.rb:924:infind_inactive_by_path'
from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems.rb:185:in try_activate' from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:132:inrescue in require'
from /Users/gordon/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in require' from extconf.rb:10:in

'

extconf failed, exit code 1

It appears to be unhappy about cairo but its not cairo itself, that installs fine as a Gem.

Sorry I can't give you anymore information. The error message is a bit sparse.

Gordon

License missing from gemspec

Some companies will only use gems with a certain license.
The canonical and easy way to check is via the gemspec
via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

There is even a License Finder to help companies ensure all gems they use
meet their licensing needs. This tool depends on license information being available in the gemspec.
Including a license in your gemspec is a good practice, in any case.

How did I find you?

I'm using a script to collect stats on gems, originally looking for download data, but decided to collect licenses too,
and make issues for missing ones as a public service :)
https://gist.github.com/bf4/5952053#file-license_issue-rb-L13 So far it's going pretty well

does not have valid gemspec

ruby_mapnik at /Users/chaos/.rvm/gems/ruby-2.0.0-p353/bundler/gems/Ruby-Mapnik-0b44e4838d54 did not have a valid gemspec.

This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
If you need to use this package without installing it from a gem repository, please contact ["[email protected]"] and ask them to modify their .gemspec so it can work with `gem build`.
The validation message from Rubygems was:
  [".yardoc/checksums", ".yardoc/objects/root.dat", ".yardoc/proxy_types", "README.textile", "ext/ruby_mapnik/_mapnik_geometry.rb.cpp", "ext/ruby_mapnik/_mapnik_geometry.rb.h", "ext/ruby_mapnik/_mapnik_glyph_symbolizer.rb.cpp", "ext/ruby_mapnik/_mapnik_glyph_symbolizer.rb.h", "lib/ruby_mapnik/ruby_mapnik.bundle", "lib/ruby_mapnik_config.rb", "test/nemis.sublime-project", "test/nemis.sublime-workspace", "test/test_mapnik_geometry.rb", "test/test_mapnik_glyph_symbolizer.rb", "tmp/rundemo.png", ".gemtest"] are not files

Status of this project

I thought it best to write down what my thoughts are with the status of this project! Apologies for the stream-of-consciousness post.

  • Dane doesn't have time to be maintainer
  • Elliot hasn't responded to any attempts at contact
  • Nobody else has stepped forward
  • I guess that buck stops with me

The main problem is that I have neither the experience with rubygems nor especially with rice to feel confident about what I'm doing!

My plan is as follows:

Rename the gem to "mapnik" and publish to rubygems

We don't have access to the old ruby_mapnik account on rubygems, and the name is slightly weird for a gem anyway. Moreover, if I manage to break things, any existing projects with gem ruby_mapnik will be unaffected

Find a method to build+test locally

I want to be able to build the gem a) in an isolated environment (so that I can try multiple versions of mapnik without ruining my environment) b) locally (so that I'm not depending on travis). I've started exploring using test-kitchen which I normally use for testing chef-recipes across platforms, since it has a large overlap in features for what I need here.

Expand supported platforms, ruby, and mapnik versions

I would like to expand support and therefore the testing setup to cover:

  • all supported ruby versions (e.g. 1.9.3, 2.1.x, 2.2.x)
  • all the main mapnik versions (e.g. 2.2.0, 2.3.x, 3.0.x)
  • ubuntu 12.04 and 14.04
  • other OSes like fedora

Accept every PR

Yep. Since my time is very limited and my knowledge too, once I have a way to run the tests I'll accept pretty much any PR that doesn't break the build. And if something bad slips through, then we write more tests.

Find more maintainers

I'm keeping a very keen eye out for anyone who can help with any aspects of this. My aim is to have at least 2 other people who can release and who also feel comfortable releasing new versions of the gem.

Feedback welcome!

Failing tests on Ubuntu 14.04, Mapnik 2.3.0-pre

Following tests are failing. Mapnik 2.3.0-pre from packages as per https://github.com/mapnik/mapnik/wiki/UbuntuInstallation.

Error: test_should_add_a_geometry(TestMapnikFeature): ArgumentError: Unable to convert Fixnum to long long
/root/Ruby-Mapnik/test/test_mapnik_feature.rb:23:in `initialize'
/root/Ruby-Mapnik/test/test_mapnik_feature.rb:23:in `new'
/root/Ruby-Mapnik/test/test_mapnik_feature.rb:23:in `test_should_add_a_geometry'
     20:   end
     21: 
     22:   def test_should_add_a_geometry
  => 23:     feature = Mapnik::Feature.new(Mapnik::Context.new, 1)
     24:     assert_equal(0, feature.number_of_geometries)
     25:     feature.add_geometries_from_wkt("POINT(30 10)")
     26:     assert_equal(1, feature.number_of_geometries)

Error: test_should_instantiate(TestMapnikFeature): ArgumentError: Unable to convert Fixnum to long long
/root/Ruby-Mapnik/test/test_mapnik_feature.rb:7:in `initialize'
/root/Ruby-Mapnik/test/test_mapnik_feature.rb:7:in `new'
/root/Ruby-Mapnik/test/test_mapnik_feature.rb:7:in `test_should_instantiate'
      4: 
      5:   def test_should_instantiate
      6:     feature_id = 12
  =>  7:     assert feature = Mapnik::Feature.new(Mapnik::Context.new, feature_id)
      8:     assert_equal feature_id, feature.id
      9:     assert_equal "Feature ( id=#{feature_id})", feature.to_s.gsub("\n", '')
     10:   end

Error: test_should_return_its_envelope(TestMapnikFeature): ArgumentError: Unable to convert Fixnum to long long
/root/Ruby-Mapnik/test/test_mapnik_feature.rb:18:in `initialize'
/root/Ruby-Mapnik/test/test_mapnik_feature.rb:18:in `new'
/root/Ruby-Mapnik/test/test_mapnik_feature.rb:18:in `test_should_return_its_envelope'
     15:   end
     16: 
     17:   def test_should_return_its_envelope
  => 18:     assert feature = Mapnik::Feature.new(Mapnik::Context.new, 1)
     19:     assert feature.envelope.kind_of?(Mapnik::Envelope)
     20:   end
     21: 

Error: test_should_return_number_of_geometries(TestMapnikFeature): ArgumentError: Unable to convert Fixnum to long long
/root/Ruby-Mapnik/test/test_mapnik_feature.rb:13:in `initialize'
/root/Ruby-Mapnik/test/test_mapnik_feature.rb:13:in `new'
/root/Ruby-Mapnik/test/test_mapnik_feature.rb:13:in `test_should_return_number_of_geometries'
     10:   end
     11: 
     12:   def test_should_return_number_of_geometries
  => 13:     assert feature = Mapnik::Feature.new(Mapnik::Context.new, 1)
     14:     assert_equal 0, feature.number_of_geometries
     15:   end
     16: 

Error: test_should_load_from_file(TestMapnikMap): ArgumentError: Unable to convert  to mapnik::Map*
/root/Ruby-Mapnik/lib/ruby_mapnik/mapnik/map.rb:107:in `__load_map__'
/root/Ruby-Mapnik/lib/ruby_mapnik/mapnik/map.rb:107:in `from_file'
/root/Ruby-Mapnik/test/test_mapnik_map.rb:182:in `test_should_load_from_file'
     179: 
     180:   def test_should_load_from_file
     181:     file = File.open(File.join(File.expand_path(File.dirname(__FILE__)), "data", "test_map.xml"))
  => 182:     map = Mapnik::Map.from_file(file)
     183:     assert map.layers.any?
     184:     assert map.styles['My Style']
     185:   end

Error: test_should_load_from_file_path_string(TestMapnikMap): ArgumentError: Unable to convert  to mapnik::Map*
/root/Ruby-Mapnik/lib/ruby_mapnik/mapnik/map.rb:107:in `__load_map__'
/root/Ruby-Mapnik/lib/ruby_mapnik/mapnik/map.rb:107:in `from_file'
/root/Ruby-Mapnik/test/test_mapnik_map.rb:175:in `test_should_load_from_file_path_string'
     172: 
     173:   def test_should_load_from_file_path_string
     174:     file_path = File.join(File.expand_path(File.dirname(__FILE__)), "data", "test_map.xml")
  => 175:     map = Mapnik::Map.from_file(file_path)
     176:     assert map.layers.any?
     177:     assert map.styles['My Style']
     178:   end

(There were also a handful of dependencies not mentioned in README.md: hoe, rake-compiler, minitest, test-unit, chunky_png.)

Compile Errors: Ubuntu 13.04 - Mapnik 2.2.0 (PPA) - Ruby 2.0.0-p247

Running through your install instructions I ran into an issue compiling this gem on Ubuntu 13.04.

I installed Mapnik 2.2.0 from the PPA and built Ruby 2.0.0-p247 from source.

I then ran:

gem install rake-compiler rake
gem install hoe rice chunky_png cairo
gem install ruby_mapnik

That barfed on me so I cloned down the gem and tried to build it from source by running:

rake gem
sudo gem install pkg/ruby_mapnik-0.1.5.gem 

Which resulted in the following:

Building native extensions.  This could take a while...
ERROR:  Error installing pkg/ruby_mapnik-0.1.5.gem:
    ERROR: Failed to build gem native extension.

    /usr/local/bin/ruby extconf.rb
extconf.rb:38:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:38:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:39:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
creating Makefile

make "DESTDIR="
compiling _mapnik_font_engine.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_shield_symbolizer.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_style.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_symbolizer.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_text_symbolizer.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
_mapnik_text_symbolizer.rb.cpp: In function ‘Rice::Object {anonymous}::get_text_displacement(const mapnik::text_symbolizer&)’:
_mapnik_text_symbolizer.rb.cpp:37:47: warning: ‘const position& mapnik::text_symbolizer::get_displacement() const’ is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:120) [-Wdeprecated-declarations]
_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::horizontal_alignment {anonymous}::get_text_horizontal_alignment(const mapnik::text_symbolizer&)’:
_mapnik_text_symbolizer.rb.cpp:52:76: warning: ‘mapnik::horizontal_alignment_e mapnik::text_symbolizer::get_horizontal_alignment() const’ is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:136) [-Wdeprecated-declarations]
_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::justify_alignment {anonymous}::get_text_justify_alignment(const mapnik::text_symbolizer&)’:
_mapnik_text_symbolizer.rb.cpp:61:70: warning: ‘mapnik::justify_alignment_e mapnik::text_symbolizer::get_justify_alignment() const’ is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:138) [-Wdeprecated-declarations]
_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::label_placement_enum {anonymous}::get_text_label_placement(const mapnik::text_symbolizer&)’:
_mapnik_text_symbolizer.rb.cpp:70:71: warning: ‘mapnik::label_placement_e mapnik::text_symbolizer::get_label_placement() const’ is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:115) [-Wdeprecated-declarations]
_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::text_transform {anonymous}::get_text_transform(const mapnik::text_symbolizer&)’:
_mapnik_text_symbolizer.rb.cpp:79:64: warning: ‘mapnik::text_transform_e mapnik::text_symbolizer::get_text_transform() const’ is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:86) [-Wdeprecated-declarations]
_mapnik_text_symbolizer.rb.cpp: In function ‘mapnik::vertical_alignment {anonymous}::get_vertical_alignment(const mapnik::text_symbolizer&)’:
_mapnik_text_symbolizer.rb.cpp:88:72: warning: ‘mapnik::vertical_alignment_e mapnik::text_symbolizer::get_vertical_alignment() const’ is deprecated (declared at /usr/include/mapnik/text_symbolizer.hpp:117) [-Wdeprecated-declarations]
compiling _mapnik_polygon_symbolizer.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_line_pattern_symbolizer.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_envelope.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_projection.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_datasource_cache.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
compiling _mapnik_feature.rb.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
make: *** [_mapnik_feature.rb.o] Error 4


Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/ruby_mapnik-0.1.5 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/gems/ruby_mapnik-0.1.5/ext/ruby_mapnik/gem_make.out

Any suggestions?

compile error due to changed signature in wkt support upstream in mapnik 2 release

g++ -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I../../../../ext/ruby_mapnik -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE     -I/usr/local/include -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common -I/usr/local/include -I/opt/sqlite-3070701/include -I/opt/boost-47-static/include -I/Library/Frameworks/UnixImageIO.framework/Versions/D/Headers -I/Library/Frameworks/GDAL.framework/Versions/1.8/Headers -I/usr/local/pgsql-9.0/include -I/usr/local/Cellar/geos/3.3.0/include -I/usr/local/include -I/usr/include -I/usr/X11/include/freetype2 -I/usr/X11/include -I/usr/include/libxml2 -isystem /opt/boost-47-static/include -g -DHAVE_JPEG -ansi -Wall -ftemplate-depth-300 -DDARWIN -DBOOST_SPIRIT_THREADSAFE -DMAPNIK_THREADSAFE -O2 -finline-functions -Wno-inline -DNDEBUG -DLIBTOOL_SUPPORTS_ADVISE -DHAVE_LIBXML2  -Wall -g -c ../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp
/usr/local/include/mapnik/wkt/wkt_factory.hpp: In function ‘void add_geometry(mapnik::Feature*, std::string)’:
/usr/local/include/mapnik/wkt/wkt_factory.hpp:32: error: too few arguments to function ‘bool mapnik::from_wkt(const std::string&, boost::ptr_vector<mapnik::geometry<mapnik::vertex<double, 2>, mapnik::vertex_vector>, boost::heap_clone_allocator, std::allocator<void*> >&)’
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:36: error: at this point in file
/usr/local/include/mapnik/wkt/wkt_factory.hpp: In function ‘void add_geometry(mapnik::Feature*, std::string)’:
/usr/local/include/mapnik/wkt/wkt_factory.hpp:32: error: too few arguments to function ‘bool mapnik::from_wkt(const std::string&, boost::ptr_vector<mapnik::geometry<mapnik::vertex<double, 2>, mapnik::vertex_vector>, boost::heap_clone_allocator, std::allocator<void*> >&)’
../../../../ext/ruby_mapnik/_mapnik_feature.rb.cpp:36: error: at this point in file
lipo: can't open input file: /var/folders/Je/Je-B-XguGWyDz+BVgq4Swk+++TI/-Tmp-//ccQPu5QV.out (No such file or directory)
make: *** [_mapnik_feature.rb.o] Error 1
rake aborted!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.