Sample Header Ad - 728x90

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 [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. enter image description here in the second part and with the 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; enter image description here How to perform a similar operation (aggregate+group by) in MySQL?
Asked by Yassine LD (838 rep)
Feb 27, 2017, 10:57 AM
Last activity: Sep 21, 2022, 01:25 PM