mapbox / geojsonio-cli

a cli for geojson.io
ISC License
169 stars 19 forks source link

GitHub Gist API truncates files > 1MB #13

Open bhousel opened 8 years ago

bhousel commented 8 years ago
screenshot 2016-10-10 10 12 49

It did construct a URL and doesn't throw any errors in the shell, so it looks like it did try something: http://geojson.io/#id=gist:/ea063f121be788d5679450ea9075ac05&map=2/20.0/0.0

bhousel commented 8 years ago

Here is a test file: https://www.dropbox.com/s/e4nhe85mgzb0srj/sample.geojson?dl=0

It validates and works ok when I drag and drop that onto geojson.io.

tmcw commented 8 years ago
  1. Please name issues anything but "doesn't work" - even just "uploads to a gist but geojson.io is not able to parse it" would be more useful, since anything is more useful than a binary "doesn't work". I'm sure you've experienced the other side of this as well.
  2. When I try this input, I get a descriptive error, site.js:25252 SyntaxError: Unexpected end of JSON input, in the console.
  3. Further digging, you can see in the Gist response that it has been truncated:

2016-10-10 at 10 54 am

So the action is to watch for the truncated flag.

bhousel commented 8 years ago

Thanks for looking into this, @tmcw

Sorry for the unhelpful issue name. The first thing I tried did not work, and I didn't have time to dig in any further. Luckily these things can be edited later by a project maintainer.

Searching for truncated got me this: https://developer.github.com/changes/2014-05-06-gist-api-now-truncating-large-files/

So it looks like GitHub gist API automatically truncates files > 1MB. But we can look at the raw_url attribute to get the full contents, up to 10MB, so this is what I'll try to do.