Giter VIP home page Giter VIP logo

walkscore-api's Introduction

Walk Score API

The API that Walk Score provides is not easy to use because you have to provide GPS coordinates in order for it to work, basically ignoring the address you actually give it, which seems really silly.

This API just submits a request as if a user went to the site and typed an address into the bar, and then it returns the following data to you, no coordinates required:

  • Walk Score
  • Transit Score
  • Bike Score
  • The Walk Score URL with all the results

Usage

Either add this file to your web server, or use the version I have at https://stmhall.ca/walkscore.php.

There is 1 required param, and 1 optional param:

  • addr: The address of the place you want to get the Walk Score for
  • variable (optional): The name of a global variable to use to assign the results to (JSONP).

As mentioned, the variable param is only used for JSONP support, in case CORS ends up being a pain in the butt.

AJAX / Fetch

async () => {
    const response = await fetch('https://stmhall.ca/walkscore.php?addr=Rogers Arena Vancouver BC');
    const { walkScore, transitScore, bikeScore, url } = await response.json();
    console.log(walkScore, transitScore, bikeScore, url);
}

JSONP

const script = document.createElement('script');
script.src = 'https://stmhall.ca/walkscore.php?variable=rogersArena&addr=Rogers Arena Vancouver BC';

script.addEventListener('load', () => {
    console.log(rogersArena);
});

document.body.appendChild(script);

walkscore-api's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.