OSMLib is library for handling OpenStreetMap data and API. This gem is a fork of 'osmlib-base' gem, originally developed by Jochen Topf.


This gem has the following modules:

  • OSMLib::Element is the base for handling Node, Way, Relation, Changeset and Tag elements.

  • OSMLib::API contains classes for interacting with OpenStreetMap API.

  • OSMLib::Database provides a way to store OSM elements locally.

  • OSMLib::OSMChange for parsing OSM Change files (.osc).

  • OSMLib::Stream for parsing a regular OSM files (.osm).


The first version of this gem is under development and has not been released yet.

To use this gem, install from source or add the following line to the Gemspec file:

gem 'osmlib', :git => 'git://github.com/vgeorge/osmlib-base.git'

Documentation: rubydoc.info/github/vgeorge/osmlib


  • georuby (gem install GeoRuby)

  • libxml-ruby (optional C-based XML parser, neededs reasonably new version) (Debian/Ubuntu: libxml-ruby1.8)

  • xmlparser (optional C-based XML parser) (Debian/Ubuntu: libxml-parser-ruby1.8)

  • builder (Debian/Ubuntu: libbuilder-ruby1.8)

Dependencies are not all installed automatically when installing the gem packages because this breaks when the packages are already installed as Debian packages.


Users mailing list (Archives): osmlib-user@rubyforge.org

Report issues: github.org/vgeorge/osmlib/issues

Wiki: wiki.openstreetmap.org/wiki/Osmlib


Development mailing list (Archives): osmlib-devel@rubyforge.org

Source code: github.com/vgeorge/osmlib

Call 'rake test' to run tests. You can change the XML parser the tests should use by setting the OSMLIB_XML_PARSER environment variable:

OSMLIB_XML_PARSER=REXML rake test  # (default)
OSMLIB_XML_PARSER=Libxml rake test
OSMLIB_XML_PARSER=Expat rake test

Part of the testing is done against OpenStreetMap Development API Server.

Follow there steps to properly setup access to the server:

  1. If you don't have yet, create a login at api06.dev.openstreetmap.org;

  2. Create a file name 'passwd' at gem root directory 'osmlib/'.

  3. Put username and password into the file, separated by a colon.




  • Jochen Topf <jochen@topf.org>

  • Serge Wroclawski <serge+osmlib@wroclawski.org>

  • Vitor George <vitor.george@gmail.com>


This work is released into the public domain. This applies worldwide. In case this is not legally possible, any entity is granted the right to use this work for any purpose, without any conditions, unless such conditions are required by law.