Because it's a "oneshot", you can do it manually (also possible running via Node)
Open a JavaScript console in your browser.
You need to loop to get an array of array of Feature
(because each FeatureCollection
have one or more Feature
)
Then, you will use the flatten function to transform the array of array into an array (a recursive function borrowed from http://stackoverflow.com/a/15030117)
// Copy/paste the text from you source https://raw.githubusercontent.com/RitterLean/Geojson/master/geofile.json
content = {
"points": [{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"coordinates": [41.9773865, 36.3372536],
"type": "Point"
},
"properties": {
"attacks": 1,
"location": "Sinjar",
"date": "2015-10-16"
}
}, {
"type": "Feature",
"geometry": {
"coordinates": [43.4873886, 34.9301605],
"type": "Point"
},
"properties": {
"attacks": 2,
"location": "Baiji",
"date": "2015-10-16"
}
}, {
...
// Be careful, incomplete because shortened for illustration
intermediate_result = content['points'].map(function(el){
return el.features;
});
function flatten(arr) {
return arr.reduce(function (flat, toFlatten) {
return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten);
}, []);
};
geojson_output = {
"type": "FeatureCollection",
"features": flatten(intermediate_result)
}
// Transform the object to a string you can paste into a file
console.log(JSON.stringify(geojson_output));
The result can be seen at http://geojson.io/#id=gist:anonymous/da10ab9afc9a5941ba66&map=4/19.48/22.32
You will see that some results have wrong coordinates (0.0000000, 0.0000000) but it's due to the original content with missing coordinates replaced by this default values in geojson.io website.
From this demo, you can also export to GeoJSON.