-
Notifications
You must be signed in to change notification settings - Fork 12
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
Expand GeoJSON filetype detection logic #45
Conversation
😆 |
@@ -23,6 +23,7 @@ function sniff(buffer, callback) { | |||
|
|||
if (header.indexOf('\"tilejson\":') !== -1) return callback(null, 'tilejson'); | |||
if ((header.indexOf('\"arcs\":') !== -1) || (header.indexOf('\"objects\":') !== -1)) return callback(null, 'topojson'); | |||
if ((header.indexOf('\"crs\":') !== -1) || (header.indexOf('\"features\":') !== -1)) return callback(null, 'geojson'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a sanity check for myself, this says "if crs
OR features
exists in the string, pass it on as a geojson"? Just taking a look at the TopoJSON specification, which does not specify crs
anywhere, but it could be added by a user if they wanted: topojson/topojson-specification#5 - I'm not worried about this use case, though.
Looking good @who8mycakes! Just a little nitpicky syntax fix I mentioned for the |
@who8mycakes looks good to me. |
Staging looks 👍 . Merging! |
Resolving GeoJSON detection issues raised here:
*#44
*#35
Sniffing for
crs
andfeatures
as top-level parameters before looking fortype
expands the detection for GeoJSON file types.