Skip to content

Instantly share code, notes, and snippets.

@rociiu
Created January 4, 2011 10:34
Show Gist options
  • Save rociiu/764624 to your computer and use it in GitHub Desktop.
Save rociiu/764624 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'OSM'
require 'OSM/StreamParser'
require 'OSM/Database'
class CustomCallback < OSM::Callbacks
def node(node)
@node = node
end
def way(_way)
end
def relation(_relation)
puts _relation
end
def result
@node
end
end
cb = CustomCallback.new
parser = OSM::StreamParser.new(:filename => 'bahrain.osm', :callbacks => cb)
puts parser.parse
#
#db = OSM::Database.new
#parser = OSM::StreamParser.new(:filename => 'bahrain.osm', :db => db)
#
#puts db.nodes.size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment