Search code examples
google-bigquerygisjqdata-analysisgeojson

GeoJSON conversion to GeoJSONL BigQuery load error


I am trying to upload to BigQuery the geospatial data of community areas of Chicago. However, I am getting the following errors messages when trying to create a table from newline delimited geoJSON file:

Error while reading data, error message: JSON table encountered too many errors, giving up. Rows: 1; errors: 1. Please look into the errors[] collection for more details.

Error while reading data, error message: JSON processing encountered too many errors, giving up. Rows: 1; errors: 1; max bad: 0; error percent: 0

Error while reading data, error message: JSON parsing error in row starting at position 0: Nested arrays not allowed.

I obtained the data from Chicago Data Portal and exported it in GeoJSON format. I used jq to convert the GeoJSON to newline delimited GeoJSON with jq like this:

type cm.geojson | jq -c ".features[]" > cm.geojsonl

What am I doing wrong & how to fix this issue?

Thank you!


Solution

  • The comment to the question by michael-entin provided the solution.

    Switching from web console to bq load in the Cloud Shell Terminal did the trick.

    bq load  --source_format=NEWLINE_DELIMITED_JSON \
    --json_extension=GEOJSON --autodetect \
    my_dataset_name.my_new_table \
    gs://cloud_storage_bucket/source.geojsonl \