Home > Enterprise >  Error when importing GeoJson into BigQuery
Error when importing GeoJson into BigQuery

Time:05-24

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] 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

CodePudding user response:

Your file is in standard GeoJSON format, but BigQuery only accepts new-line delimited GeoJSON files and individual GeoJSON objects (see documentation: https://cloud.google.com/bigquery/docs/geospatial-data#geojson-files). So, you should first convert the dataset to the appropiated format. Here is a good and simple explanation on how it works: https://stevage.github.io/ndgeojson/.

  • Related