Skip to content

Instantly share code, notes, and snippets.

@JamesChevalier
Created February 8, 2014 00:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JamesChevalier/8874816 to your computer and use it in GitHub Desktop.
Save JamesChevalier/8874816 to your computer and use it in GitHub Desktop.
This is my script to generate OSMs out of all of a country's POLY files.
#!/usr/bin/env ruby
Dir.glob('poly/*.poly').each_slice(50) do |group|
bp_wx = ''
group.each do |poly_file|
file = File.basename(poly_file, '.poly')
city, region = file.split('_')
bp_wx << "--buffer bufferCapacity=50000"\
" --bp file='poly/#{city}_#{region}.poly'"\
" --buffer bufferCapacity=50000"\
" --wx file='done/#{city}_#{region}.osm' "
end
system("time osmosis/bin/osmosis --read-pbf-fast workers=20"\
" file='source/COUNTRY-latest.osm.pbf' --tee #{group.count}"\
" #{bp_wx}")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment