Bug #43493 union function returns polygon not multipolygon for non-intersecting polygons
Submitted: 9 Mar 10:52 Modified: 7 May 14:01
Reporter: John Powell
Status: Patch queued
Category:Server: GIS Severity:S3 (Non-critical)
Version:5.1 WL#1326 OS:Linux
Assigned to: Alexey Botchkov Target Version:
Tags: gis, multipolygon, polygon, union function
Triage: Triaged: D3 (Medium)

[9 Mar 10:52] John Powell
Description:
The union function performed on two non-intersection polygons returns a polygon and not a
multipolygon. A polygon is defined as a single outer ring, with any number of inner rings.
A multipolygon is defined as any number of non-intersecting polygons.

How to repeat:
create two non-intersection polygons

mysql>set @geom=geomfromtext('POLYGON((0 0, 10 0, 0 10, 0 0))');
mysql>set @geom1=geomfromtext('POLYGON((100 100, 110 100, 100 110, 100 100))');

create new geometry, the union of these two:

mysql>set @union=union(@geom, @geom1);

select result

mysql> select astext(@union);
+----------------------------------------------------------------+
| astext(@union)                                                 |
+----------------------------------------------------------------+
| POLYGON((0 0,0 10,10 0,0 0),(100 100,100 110,110 100,100 100)) | 
+----------------------------------------------------------------+

The result should be MULTIPOLYGON(((0 0,0 10,10 0,0 0)),((100 100,100 110,110 100,100
100)))
[10 Mar 9:59] Sveta Smirnova
Thank you for the report.

Verified as described.
[7 May 14:01] John Powell
Confirmed fixed. Thanks for the quick resolution.