MySQL equivalent of a spatial ST_Union aggregate function?
4
votes
1
answer
1295
views
I'm working on a DB-spacial project in Mysql and I was trying to perform a union operation for a group of shapes. Im looking for something similar to the SQL Server function [
in the second part and with the
How to perform a similar operation (aggregate+group by) in MySQL?
UnionAggregate
](https://learn.microsoft.com/en-us/sql/t-sql/spatial-geometry/unionaggregate-geometry-data-type?view=sql-server-2017) , or the PostGIS Spatial Aggregate function [ST_Union
](http://www.postgis.net/docs/ST_Union.html)
for example (In SQL SERVER):
SELECT
geometry::STGeomFromWKB(Shape,27582),
area_code
FROM area_table
WHERE area_code='xxxxxxx';
ST_GeomFromWKB do the same job in Mysql.

UnionAggregate
function + group by :
select
dbo.UnionAggregate((geometry::STGeomFromWKB(Shape,27582)).MakeValid()),
area_code
FROM area_table
WHERE area_code='xxxxxxx'
GROUP BY area_code;

Asked by Yassine LD
(838 rep)
Feb 27, 2017, 10:57 AM
Last activity: Sep 21, 2022, 01:25 PM
Last activity: Sep 21, 2022, 01:25 PM