Module: BroadbandMap::Client::Census

Included in:
BroadbandMap::Client
Defined in:
lib/broadband_map/client/census.rb

Instance Method Summary collapse

Instance Method Details

#census_coords(params = {}, options = {}) ⇒ Hash

Returns the US Census Block geography ID information given a passed Latitude and Longitude.

Examples:

census_coords({:geography_type => 'block', :latitude => 42.456, :longitude => 74.987})

Parameters:

  • params (Hash) (defaults to: {})

    :geography_type, :latitude, :longitude and optional :format, :callback

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

  • (Hash)

See Also:



13
14
15
16
# File 'lib/broadband_map/client/census.rb', line 13

def census_coords(params={}, options={})
  params = {:format => 'json'}.merge(params)
  get("census/#{params[:geography_type]}?latitude=#{params[:latitude]}&longitude=#{params[:longitude]}&format=#{params[:format]}&callback=#{params[:callback]}")
end

#census_fips(params = {}, options = {}) ⇒ Hash

Returns the geography of a specified geography type by geography id within the entire United States.

Examples:

census_fips({:geography_type => 'state', :fips => '36'})

Parameters:

  • params (Hash) (defaults to: {})

    :geography_type, :fips and optional :format, :callback

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

  • (Hash)

See Also:



26
27
28
29
# File 'lib/broadband_map/client/census.rb', line 26

def census_fips(params={}, options={})
  params = {:format => 'json'}.merge(params)
  get("census/#{params[:geography_type]}/fips/#{params[:fips]}?format=#{params[:format]}&callback=#{params[:callback]}")
end

#census_geo_name(params = {}, options = {}) ⇒ Hash

Returns all the geographies specified by a geography name (e.g., Washington) of a specific geography type (e.g., congressional district) within the entire United States.

Examples:

census_geo_name({:geography_type => 'county', :geography_name => 'fai'})

Parameters:

  • params (Hash) (defaults to: {})

    :geography_type, :geography_name and optional :format, :max_results, :callback

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

  • (Hash)

See Also:



39
40
41
42
# File 'lib/broadband_map/client/census.rb', line 39

def census_geo_name(params={}, options={})
  params = {:format => 'json', :max_results => 100}.merge(params)
  get("census/#{params[:geography_type]}/#{params[:geography_name]}?format=#{params[:format]}&maxresults=#{params[:max_results]}&all=#{params[:all]}")
end