Skip to content

Instantly share code, notes, and snippets.

@jnicho02
Created April 26, 2013 13:20
Show Gist options
  • Save jnicho02/5467350 to your computer and use it in GitHub Desktop.
Save jnicho02/5467350 to your computer and use it in GitHub Desktop.
writes out ruby code that can be fed in to Trimble Sketchup
require 'OSM/API'
@api = OSM::API.new
db = @api.get_bbox(-5.2134537,50.040992,-5.0993322,50.2582661)
puts 'require \'sketchup.rb\''
puts 'model = Sketchup.active_model'
db.ways.each { |way|
prev = nil
way[1].node_objects.each { |node|
if (prev)
puts 'model.entities.add_line( (model.latlong_to_point [' + prev.lon + ',' + prev.lat + ']), (model.latlong_to_point [' + node.lon + ',' + node.lat + ']) ) '
end
prev = node
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment