class DataAnon::Utils::GeojsonParser
Public Class Methods
Source
# File lib/utils/geojson_parser.rb, line 8 def self.address file_path self.new(file_path).parse 'address' end
Source
# File lib/utils/geojson_parser.rb, line 20 def self.city file_path self.new(file_path).parse 'city' end
Source
# File lib/utils/geojson_parser.rb, line 24 def self.country file_path self.new(file_path).parse 'country' end
Source
# File lib/utils/geojson_parser.rb, line 28 def initialize file_path @places = File.read(file_path).split(/\n/) end
Source
# File lib/utils/geojson_parser.rb, line 16 def self.province file_path self.new(file_path).parse 'province' end
Source
# File lib/utils/geojson_parser.rb, line 12 def self.zipcode file_path self.new(file_path).parse 'postcode' end
Public Instance Methods
Source
# File lib/utils/geojson_parser.rb, line 32 def parse property result_list = [] @places.each do |loc| geom = RGeo::GeoJSON.decode(loc, :json_parser => :json) result_list.push(geom[property]) end result_list end