codeforamerica / openbus-api

http://api.chab.us
ISC License
17 stars 6 forks source link

Use GeoJSON #9

Closed junosuarez closed 10 years ago

junosuarez commented 10 years ago

/buses should return a FeatureCollection

/buses/tail should be an EventSource stream of Feature objects with ids which are consistent across add / change / remove events.

this will break existing things and that's okay

junosuarez commented 10 years ago

notice to watchers

the above referenced commit contains breaking changes. I don't expect to be making these very frequently, but bear with me in the beginning as we get everything stabilized. Apps built against the original API will break. But, as a consolation prize, the /buses endpoint is now returning valid GeoJSON, which means you can just copy/pasta it into a wide variety of existing mapping tools, such as a gist or Leaflet, and it will Just Work :tm: :+1: :

Example: https://gist.github.com/jden/11155937

acedrew commented 10 years ago

Will this affect the /buses/tail as well?

junosuarez commented 10 years ago

@acedrew yes, the event names will be the same, and the response will be a single GeoJSON Feature object, like:

{"type":"Feature","geometry":{"type":"Point","coordinates":[-85.24133835977582,35.127758652416624]},"properties":{"color":"#339999","route":"16","routeDirection":"[Outbound]","direction":"South East Bound","heading":"SSE","stop":"NORTHGATE"},"id":"112"}