hackgvl / trolley-tracker-api-dot-net

API for tracking Greenville's trolleys with .NET
MIT License
4 stars 6 forks source link

GeoJSON for Trolley Stops #25

Closed allella closed 7 years ago

allella commented 7 years ago

Mike, We were talking about eventually having the option for the Trolley Tracker to utilize public map layers.

I wondered if it would be possible to publish a read-only GeoJSON version of the trolley stops and we could include it in the available map layers.

The near term vision is to put these map layers behind something like Cloudflare caching to make them super scalable. That should allow us to syndicate fresh data and avoid putting non-app load on origin servers.

Thoughts?

ajhodges commented 7 years ago

I do still like this idea.. but which stops would this endpoint return? Some stops in the DB are for 'temporary' routes that are rarely used, etc. Maybe just return all stops that have permanent signage/used in the main trolley routes?

bikeoid commented 7 years ago

One query might be for all stops on all currently scheduled routes. That will be a fast query, and even 100 or 500 of these per day would not add a measurable load to the server. It would be a new simple WebAPI call to return the GeoJSON.

allella commented 7 years ago

Good point Hodges. We have no use cases. More of a demonstration of capability at this point.

bikeoid commented 7 years ago

The public endpoint for all stops today is at http://api.yeahthattrolley.com/api/v1/Stops . (Returns JSON upon request)

allella commented 7 years ago

Thanks Mike. More specifically we were looking for GeoJSON, but we can certainly add something to parse and convert to GeoJSON. Thanks. Jim

bikeoid commented 7 years ago

Here is the published point on the server http://api.yeahthattrolley.com/api/v1/Stops/Regular - should pass the GeoJSON test.

allella commented 7 years ago

It does look a bit different than expected for GeoJSON and the validator I used doesn't like it as GeoJSON http://geojsonlint.com/

Here's a map layer from an SC Codes project in GeoJSON format. https://data.openupstate.org/maps/libraries/geojson.php

We could work with what you have (JSON), so don't sweat if it's a pain to render in GeoJSON.

bikeoid commented 7 years ago

I used a Geo JSON library, but probably didn't read far enough to figure out how to generate the right format. I now know about geojsonlint.com! Thinking further, even if I generated the right format, I'm not sure how to pass it through the ASP.NET web api without nested formatting as a pure JSON string. So I'll have to give it up here unless it's a big issue to use.

allella commented 7 years ago

No problem. Thanks for getting it that far.