Error when importing GeoJson into BigQuery

Viewed 135

I'm trying to load GeoJson data [1] into BigQuery via Cloud Shell but I'm getting the following error:

Failed to parse JSON: Top-level GeoJson 'type' member should have value 'Feature', but was 'FeatureCollection'.; ParsedString returned false; Could not parse value; Parser terminated before end of string

It feels like the GeoJson file is not formatted properly for BQ but I have no idea if that's true or how to fix it.

[1] https://github.com/tonywr71/GeoJson-Data/blob/master/australian-suburbs.geojson

2 Answers

Expounding on @scespinoza's answer, I was able to convert to new-line delimited GeoJSON and load it to Bigquery with the following steps:

  1. geojson2ndjson geodata.txt > geodata_converted.txt

  2. Using this command, I encountered an error: enter image description here

    But was able to create a workaround by splitting the data into 2 tables, applying the same command.

Loaded table in Bigquery:

enter image description here

enter image description here

Related