Trying to import Google Maps geojson data into a MongoDB and thought it would be quite easy to do so, since the geojson data is quite similar to json. Turns out to be uncomfortably difficult.
My Google Maps geojson data looks like this:
{
"type": "FeatureCollection",
"name": "All",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "Name": "KSA", "description": "750 acres" }, "geometry": { "type": "Point", "coordinates": [ -72.8032981, 43.6176027 ] } },
{ "type": "Feature", "properties": { "Name": "JPR", "description": null }, "geometry": { "type": "Point", "coordinates": [ -72.5045437, 44.9379601 ] } },
:
{ "type": "Feature", "properties": { "Name": "SAM", "description": null }, "geometry": { "type": "Point", "coordinates": [ 10.1589005, 47.1394002 ] } }
]
}
The responses that seemed most applicable were these threads: How to import Geojson file to MongoDB and Unexpected end of JSON input in MongoDB Compass
But after pruning the document, and removing the commas between the documents, I either had MongoDB refusing to import, citing various errors such as "Unexpected end of JSON input", or similar failures from various online minifiers & validators.
While ok with a command line, I'm not comfortable with how the MongoDB command line works (having only used Compass), so the potential command line solutions seem unclear to me as to how they work.
I'd have thought it would be simple to push the cleaned up json through an online minification tool, yet so far its not working.
To save further hours, does anyone have a suggestion as to how to get an online tool and this import to work please?