class USGeo::Zcta
ZIP code tabulation area. These roughly map to U.S. Postal service ZIP codes, but are designed for geographic and demographic purposes instead of mail routing. In particular certain optimizations that the Postal Service makes to optimize mail routing are omitted or smoothed over (i.e. ZIP codes mapping to a single building, one-off enclaves, etc.)
ZCTA's can span counties, but the one with the majority of the residents is identified as the primary county for when a single county is required.
ZCTA's can span urbanized area, but the one with the majority of the residents is identified as the primary urbanized area for when a single area is required.
Public Class Methods
load!(uri = nil)
click to toggle source
# File lib/us_geo/zcta.rb, line 42 def load!(uri = nil) location = data_uri(uri || "zctas.csv") import! do load_data_file(location) do |row| load_record!(zipcode: row["ZCTA5"]) do |record| record.primary_county_geoid = row["Primary County"] record.primary_urban_area_geoid = row["Primary Urban Area"] 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