Skip to content

jimxlin/open-data-addresses

Repository files navigation

Open Data Addresses

This is a generator for real addresses, meant to be used for developing and testing applications that require them, such as geocoding. Data is taken from various U.S. government open data websites, more information here.

Data sets used:

San Francisco: Registered Business Locations
New York City: Legally Operating Businesses Los Angeles: Listing of Active Businesses

Installation

Add this line to your application's Gemfile:

gem 'open_data_addresses'

And then execute:

$ bundle

Or install it yourself as:

$ gem install open_data_addresses

Usage

# 3 region are currently supported:
#   'SF'  => San Francisco (default)
#   'NYC' => New York City
#   'LA'  => Greater Los Angeles Area

OpenDataAddresses.address('SF') #=> { street: '1955 Leavenworth St', city: 'San Francisco', state: 'CA', zip: '94133' }

# Defaults to 10 addresses
# Addresses are guaranteed to be unique
OpenDataAddresses.addresses(2, 'SF') #=> [{ street: '1455 Market St', city: 'San Francisco', state: 'CA', zip: '94103' }, { street: '840 Post St', city: 'San Francisco', state: 'CA', zip: '94109' }]

License

The gem is available as open source under the terms of the MIT License.