Using Ruby OSMlib

Just doing a bit of noodling with data to follow up my investigations during the LinkedGov Hack Day. I was working on an OSM ThingMatcher to find you an existing node at a particular postal address. The idea is that uniquely tagged objects such as doctors surgeries, postboxes, etc. will be more accurately positioned in OSM than the geolocation you'll get by geocoding the postcode. I wrote some code to pull in and parse OSM xml, but after a hunt I have found the ruby OSMLib. Amongst other things, it gives you quick access to the OSM API. There are examples at

gem install osmlib-base


require 'OSM/API'
@api =
location = 50.83362, -0.1387
db = @api.get_bbox(location[1] - 0.01, location[0] - 0.01, location[1] + 0.01, location[0] + 0.01)
post_boxes = {|node|node.tags.detect{|tag|tag[1]=="post_box"} }

gives an Array of post_boxes within a bounding box.

openstreetmap hacking
It's All In The Game blog (c) 2005-16 by Jez Nicholson