I have a table called drawn_items with columns “the_geom”, “fsrn_db” , & “area” in Carto2 which is queried by SQL. Having recreated the table in Carto 3, in order to use the query, I must translate it from postGIS to Bigquery. “the geom” changes to “geom” and I think ST_GeomFromGeoJSON changes to ST_GEOGFROMGEOJSON. An access token must be concatenated to the end of the string and I know this is working from testing on another query.
SQL Query in postGIS for Carto 2 (working)
"INSERT INTO drawn_items (the_geom, fsrn_db, area) " +
"VALUES (ST_SetSRID(ST_GeomFromGeoJSON('" +
drawing + "'), 4326), '" +
enteredFSRN + "', '" +
seeArea2 + "')";
Attempt at SQL Query in Bigquery for Carto 3
let sql =
"INSERT INTO shared.drawn_items (geom, fsrn_db, area) " +
"VALUES (ST_GEOGFROMGEOJSON('" +
drawing + "'), '" +
enteredFSRN + "', '" +
seeArea2 + "')"+access_token;
However, this does not work and I get a 400 error.
How should it be structured?
The location of the error referenced above as 1:215 is the first pair of coordinates, so it seems to me that ST_GEOGFROMGEOJSON is not translating the geoJSON into BigQuery properly?

