[OSM-dev] osm-data - a ruby osm object library

Immanuel Scholz immanuel.scholz at gmx.de
Wed Aug 9 18:03:05 BST 2006


Hi,

in subversion path util/osm-data/lib is a new library for easier handling
with the osm data objects. I extracted this from little-osm.

It is currently used in little-osm, the testserver.rb script and
planet2mysql.rb


To use it, include the util/osm-data/lib directory to your include path
and then require "osm/data" or "osm/rexml" (if you want to/from XML
support). Look for one of the scripts mentioned above for an example.

Some examples:

node = Node.new :id => 23, :lat => 51, :lon => 11, :timestamp => Time.now
puts node.to_xml # prints: <node id='23' lat='51' lon='11' />
puts node.to_uid # prints an id, that is unique among all osm
                 # primitives, not only all nodes
node["name"] = "Baker Street" # access to tags via []
puts node.timestamp  # prints the creation time


Documentation can be generated by calling to "rdoc" within the osm-data
subdirectory.

Ciao, Imi
PS: http://wiki.openstreetmap.org/index.php/Osm-data





More information about the dev mailing list