gbfs2geojson: GBFS to GeoJSON proxy

Convert GBFS API endpoints into GeoJSON responses.
All endpoints support CORS.

Hosted on Glitch.

ENDPOINTS

DESCRIPTION

GBFS, the General Bikeshare Feed Specification, is great, but most mapping libraries interoperate with GeoJSON much more easily. This is an API that proxies GBFS APIs, returning GeoJSON.

A NOTE ON ENCODING

URLs passed as query params should be url encoded. For example:

https://data.lime.bike/api/partners/v1/gbfs/washington_dc/free_bike_status.json

should be passed as:

https%3A%2F%2Fdata.lime.bike%2Fapi%2Fpartners%2Fv1%2Fgbfs%2Fwashington_dc%2Ffree_bike_status.json

To easily encode an url, you can use DuckDuckGo. Search for "urlencode https://data.lime.bike/api/partners/v1/gbfs/washington_dc/free_bike_status.json" for example.

DO IT YOURSELF

Internally, this proxy uses JMESPath to convert the GBFS JSON to GeoJSON. You can use the same JMESPath query yourelf in any of the multitudes of languages that have a JMESPath implemenation. Note that to get the station GeoJSON this proxy returns, you must merge location and status feeds.

GBFS bikes to GeoJSON:

{type: `FeatureCollection`, features: data.bikes[*].{id: bike_id, geometry: {type: `Point`, coordinates: [lon, lat]}, properties: @}}

GBFS station information to GeoJSON:

{type: `FeatureCollection`, features: data.stations[*].{id: station_id, geometry: {type: `Point`, coordinates: [lon, lat]}, properties: @}}

GBFS station status to GeoJSON:

{type: `FeatureCollection`, features: data.stations[*].{id: station_id, properties: @}}

See this gist for more info and examples.

AUTHOR

Created by Daniel Schep.