examples/us_states/map.rb
def json(filename)
    
    dir = File.expand_path(File.dirname(__FILE__))
    file_name = dir + "/#{filename}"
    file = File.read(file_name)
    
    # parse the json file
    @us_states = JSON.parse(file)

  end
#------------------------------------------------------------------------------------
# Parses a file in GeoJson format and saves it as @us_states
# @param filename [String] the name of the file to parse
#------------------------------------------------------------------------------------
Parses a file in GeoJson format and saves it as @us_states
Parses a file in GeoJson format and saves it as @us_states
def json(filename)
    dir = File.expand_path(File.dirname(__FILE__))
    file_name = dir + "/#{filename}"
    file = File.read(file_name)
    @us_states = JSON.parse(file)
  end
def json ( filename ) dir = File . expand_path ( File . dirname ( __FILE__ ) ) file_name = dir + "/#{filename}" file = File . read ( file_name ) @us_states = JSON . parse ( file ) end
Parses a file in GeoJson format and saves it as @us_states
Parses a file in GeoJson format and saves it as @us_states
# parse the json file
filename
the name of the file to parse
the name of the file to parse