'How to use ST_UNION in BigQuery
I have a table in BigQuery, called project.dataset.table. This table, among some other columns, has an ourpolygons column, with datatype GEOGRAPHY.
I am trying to apply ST_UNION to the ourpolygons column, to get a multipolygon, a union of all our polygons. ST_UNION is a Geography function in BigQuery.
Using this answer, I tried:
SELECT ST_UNION(ourpolygons) FROM (SELECT ourpolygons FROM `project.dataset.table`) AS multipolig;
I get the error:
No matching signature for function ST_UNION for argument types: GEOGRAPHY. Supported signatures: ST_UNION(GEOGRAPHY, GEOGRAPHY); ST_UNION(ARRAY<GEOGRAPHY>) at [1:8]
I also tried:
SELECT ST_UNION(ourpolygons) FROM `project.dataset.table` AS multipolig;
Giving me the error:
No matching signature for function ST_UNION for argument types: GEOGRAPHY. Supported signatures: ST_UNION(GEOGRAPHY, GEOGRAPHY); ST_UNION(ARRAY<GEOGRAPHY>) at [1:8]
Eventually, I would put the result into a new table, with one row: the union.
How do I select all polygons from an existing table and create their union?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
