Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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