class USGeo::UrbanArea

Urban areas are split into either urbanized areas (population > 50,000) or urban cluster (population < 50,000).

Public Class Methods

load!(uri = nil) click to toggle source
# File lib/us_geo/urban_area.rb, line 36
def load!(uri = nil)
  location = data_uri(uri || "urban_areas.csv")
 
  import! do
    load_data_file(location) do |row|
      load_record!(geoid: row["GEOID"]) do |record|
        record.type = (row["Population"].to_i >= 50_000 ? "UrbanizedArea" : "UrbanCluster")
        record.name = row["Name"]
        record.primary_county_geoid = row["Primary County"]
        record.population = row["Population"]
        record.housing_units = row["Housing Units"]
        record.land_area = area_meters_to_miles(row["Land Area"])
        record.water_area = area_meters_to_miles(row["Water Area"])
        record.lat = row["Latitude"]
        record.lng = row["Longitude"]
      end
    end
  end
end

Public Instance Methods

cluster?() click to toggle source
# File lib/us_geo/urban_area.rb, line 61
def cluster?
  raise NotImplementedError
end
urbanized?() click to toggle source
# File lib/us_geo/urban_area.rb, line 57
def urbanized?
  raise NotImplementedError
end