|
7 months ago | |
---|---|---|
examples | 7 months ago | |
maps | 7 months ago | |
src | 7 months ago | |
.gitignore | 7 months ago | |
README.md | 7 months ago | |
package-lock.json | 7 months ago | |
package.json | 7 months ago | |
rollup.config.js | 7 months ago | |
test.http | 7 months ago | |
tsconfig.client.json | 7 months ago | |
tsconfig.json | 7 months ago | |
tsconfig.server.json | 7 months ago |
Yet another utility for discovering your bin day. Heavily over-engineered - but it was fun.
Mostly, it was a chance to discover some tech I haven't used before. In particular, Rollup, Turf, and Crank.
There are 4 ways to use this library.
Example: Crank Widget
Endpoint: /js/widget.js?map=...&target=...
map
the config nametarget
the DOM element IDThis renders a widget into your page which then prompts for your GPS location.
Example: Library
Endpoint: /js/lib.js?map=...
map
the config nameThis imports a globally library Binday
which exposes the methods
for retrieving your bin day/week.
Binday.getWeek()
which recycling week is it?Binday.getDay({ latitude, longitude})
what day is my bin collection?Example: Static Widget
Endpoint: /widget?map=...&lat=...&lng=...
map
the config namelat
your latitudelng
your longitudeThis returns a JS-free HTML copy of the widget.
Example: API
Endpoint: /api/bins?map=...&lat=...&lng=...
map
the config namelat
your latitudelng
your longitudeThis returns a JSON body of your bin collection data.
{
"bin_day": "wednesday",
"bin_week": "green"
}
/api/maps
To list all configs provided and a link view their map on geojson.io./api/geojson?map=...
Returns the geojson component.This is a config file.
{
"bin_pattern": ["yellow", "green"],
"map": { "type": "FeatureCollection", "features": [...] }
}
bin_pattern
The pattern of bins from week 1 of the current year.
i.e. ['yellow', 'green', 'blue']
should produce:
map
A GeoJSON object in WGS84 coordinates.
This is a simple FeatureCollection with just Polygon or MultiPolygon
children. Most importantly, these should contain a property called weekday
that contains whichever day applies to that zone.
Use geojson.io to create your own.
MIT