Coder Social home page Coder Social logo

sfpark-geojson's Introduction

sfpark-geojson

Simple javascript module for translating the response taken from an SFPark API (http://api.sfpark.org/sfpark) query to a GeoJSON compatible format. This can then be used with a GeoJSON compatible service or application such as Google Maps.

Usage

<script type="text/javascript" src="sfpark-geojson.js"></script>
var queryUrl = '//crossorigin.me/http://api.sfpark.org/sfpark/rest/availabilityservice?radius=3.0&uom=mile&response=json';
$.ajax({
  type: 'GET',
  dataType: 'json',
  url: queryUrl
}).done(function(data) {
  var geoJson = sfParkGeoJson.translate(data);
  //do things with geoJson
});
var map = new google.maps.Map(document.getElementById('map'), { });
map.data.addGeoJson(geoJson);

Sample

A sample Google Map using sfpark-geojson can be viewed here:

https://htmlpreview.github.io/?https://github.com/plmwong/sfpark-geojson/blob/master/public/garage-availability.html

Or here:

https://htmlpreview.github.io/?https://github.com/plmwong/sfpark-geojson/blob/master/public/parking-rates.html

If you'd rather run locally, you can run a static web server using nodejs and npm:

npm install
node .

Then browse to http://localhost:8080/garage-availability.html to view a sample Google Map using data from the SFPark API.

Sample Google Map

sfpark-geojson's People

Contributors

plmwong avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

smartcitylabs

sfpark-geojson's Issues

Support rates / pricing

You can request parking location rates from the SFPark API by appending pricing=yes to the query.

This results in a RATES / RS object being populated in the results collection.

If this collection is present, it should be mapped to a corresponding geojson property/properties.

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.