WalkscoreEx (walkscore_ex v0.1.0)

This is an Elixir client for the WalkScore API.

Make sure you add walkscore_ex to your mix.exs and then run mix deps.get.

  def deps do
    [
      {:walkscore_ex, "~> 0.0.1"}
    ]
  end

In order to use WalkscoreEx, you must register and receive an API key from WalkScore and save that value in your config, eg:

config :walkscore_ex, walkscore_api_key: "YOUR_API_KEY_FROM_WALKSCORE"

Link to this section Summary

Functions

This method accepts the string parameters latitude, longitude, and address. It makes an API call to the WalkScore API and returns a decoded JSON response.

Link to this section Functions

Link to this function

format_url(lat, lon, address, api_key)

Link to this function

get_score(latitude, longitude, address)

This method accepts the string parameters latitude, longitude, and address. It makes an API call to the WalkScore API and returns a decoded JSON response.

examples

Examples

  # params
  latitude = "38.897675"
  longitude = "-77.036547"
  address = "1600 Pennsylvania Avenue NW, Washington, DC, USA"

  # API call
  response = WalkscoreEx.get_score(latitude, longitude, address)

  # value of `response`
  %{
    "description" => "Very Walkable",
    "help_link" => "https://www.redfin.com/how-walk-score-works",
    "logo_url" => "https://cdn.walk.sc/images/api-logo.png",
    "more_info_icon" => "https://cdn.walk.sc/images/api-more-info.gif",
    "more_info_link" => "https://www.redfin.com/how-walk-score-works",
    "snapped_lat" => 38.898,
    "snapped_lon" => -77.037,
    "status" => 1,
    "updated" => "2023-02-13 03:39:18.898986",
    "walkscore" => 83,
    "ws_link" => "https://www.walkscore.com/score/1600-Pennsylvania-Avenue-NW-Washington-DC-USA/lat=38.897675/lng=-77.036547"
  }