Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a remote geojson datasource #39

Open
hampelm opened this issue Feb 13, 2013 · 4 comments
Open

Add a remote geojson datasource #39

hampelm opened this issue Feb 13, 2013 · 4 comments

Comments

@hampelm
Copy link

hampelm commented Feb 13, 2013

We'd like to fetch data from a remote location as GeoJSON. Or maybe even TopoJSON?? (cc @prashtx)

(hopefully will have cleaner code for this to share soon)

@bensheldon
Copy link
Member

Are you planning to cache the results, or have it fetched dynamically on every map rendering call? If caching, you could probably just replace this section of code with your http request:

https://github.com/codeforamerica/nodetiles-core/blob/master/datasources/GeoJson.js#L64-L77

@prashtx
Copy link

prashtx commented Feb 13, 2013

I think we'd ideally use HTTP caching headers to avoid excessive data transfer while still supporting dynamic sources.

@hampelm
Copy link
Author

hampelm commented Feb 14, 2013

Here's what I did for my simple remote geojson datasource a week or two ago (basically what @bensheldon suggested).

This is more a request that something similar be included in core, since it's built for a relatively common use-case.

@Mr0grog
Copy link
Member

Mr0grog commented Feb 14, 2013

Made a quick comment on the gist as to how it could be slightly simpler. If we brought it into core, we could probably make some tweaks to GeoJsonSource so it's easier to extend, though I still quite like the idea of composing a transport method (HTTP) with something for interpreting and storing the data (GeoJSON).

That aside, though, it sounds like there's a separate issue here: the existing data sources (and @hampelm's) are designed to load some data and then hold on to it as if the underlying storage isn't going to change. What @prashtx is talking about sounds more like he'd want to [potentially] request data from the remote source every time, effectively assuming that it is in constant flux. That's neat, but definitely invites some complicated scenarios. For example, what happens when you have a shape that overlaps two tiles, but we render the first tile before that shape exists and the second one after?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants