[Python] BigQuery does not recognize Shapely Polygons

Discussão em 'Python' iniciado por Stack, Novembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    I have some polygons which I am trying to upload to BigQuery. The polygons are creating shapely based on a Point (lat & long) and a radius, i.e., polygon = shapely.geometry.Point(lng, lat).buffer(r). They are first converted into a dataframe of geojsons using geojson.dumps(mapping(polygon)) then uploaded to BigQuery and finally converted to a GEOGRAPHY type using SELECT SAFE.st_geogfromgeojson(polygon, make_valid => TRUE) FROM table_name.

    However, as a part of this process, some entries became NULL (there were no missing values in the uploaded dataframe). I suspect this has to do with shapely polygons not being completely recognized by BigQuery and the ones that are invalid were automatically removed.

    Is there a way to make sure this does not happen?

    Continue reading...

Compartilhe esta Página