Created
March 27, 2014 11:29
-
-
Save bertspaan/9805501 to your computer and use it in GitHub Desktop.
Read CitySDK schools data, export to CSV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
schools = JSON.parse(File.open('schools.json').read, {symbolize_names: true}) | |
schools[:results].each do |school| | |
data = school[:layers][:"duo.schools.secondary"][:data] | |
lat, lon = school[:geom][:coordinates] | |
csv_row = { | |
:professional => data[:niveau_pro], | |
:vbo => data[:niveau_vbo], | |
:vwo => data[:niveau_vwo], | |
:havo => data[:niveau_havo], | |
:mavo => data[:niveau_mavo], | |
:vestigingsnaam => data[:vestigingsnaam], | |
:lat => lat, | |
:lon => lon | |
} | |
puts csv_row.inspect | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment