Bug #31753 Buffer/area functions only return first row of set
Submitted: 22 Oct 2007 14:49 Modified: 25 Nov 2007 16:09
Reporter: John Powell Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: GIS Severity:S4 (Feature request)
Version:Ver 8.42 distrib 5.1.20-beta OS:Linux
Assigned to: Alexey Botchkov CPU Architecture:Any
Tags: gis
Triage: D5 (Feature request)

[22 Oct 2007 14:49] John Powell
Description:
The buffer function in conjunction with the area function only returns the first row of a set.

The coordinates of any buffer after the first one look completely wrong, with only 3 points, all extremely close to 0;

How to repeat:
create table test(geom geometrycollection);

insert into test(geomfromtext('POLYGON((0 0, 10 10, 0 8, 0 0))');

insert into test values(geomfromtext('POLYGON((1 1, 10 10, 0 8, 1 1))');

select astext(geom), area(geom),area(buffer(geom,2)) from test;
+------------------------------+------------+----------------------+
| astext(geom)                 | area(geom) | area(buffer(geom,2)) |
+------------------------------+------------+----------------------+
| POLYGON((0 0,10 10,0 8,0 0)) |         40 |      117.24167639592 | 
| POLYGON((1 1,10 10,0 8,1 1)) |         36 |                    0 | 
+------------------------------+------------+----------------------+
2 rows in set (0.00 sec)

select astext(buffer(geom,1));

 POLYGON((0 -1,-0.049067674327418 -0.99879545620517,-0.098017140329561 -0.9951847266722,-0.14673047445536 -0.98917650996478,-0.19509032201613 -0.98078528040323,-0.24298017990326 -0.97003125319454,-0.29028467725446 -0.95694033573221,-0.33688985339222 -0.94154406518302,-0.38268343236509 -0.92387953251129,-0.42755509343028 -0.90398929312344,-0.471396736826 -0.88192126434835,-0.51410274419322 -0.85772861000027,-0.555570......etc, etc))

|POLYGON((-1.0375421075331e-158 -8.8553075388322e+202,1.9119937773622e+42 7.3985888892284e+50,-1.0375421075331e-158 -8.8553075388322e+202))
[24 Oct 2007 18:52] Lenz Grimmer
For the reviewer: this report is based on a build from the mysql-5.1-wl1326 source tree. Please assign it to Holyfoot as we're currently working on improving the openGIS functionality (see http://forge.mysql.com/wiki/GIS_Functions for more info). Thanks!
[25 Nov 2007 16:09] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/38447

ChangeSet@1.2641, 2007-11-25 20:03:17+04:00, holyfoot@mysql.com +1 -0
  Bug #31753 Buffer/area functions only return first row of set
  
  gcalc_result_receiver didn't clean itself properly with the
  ::reset call, so consequent calls of Buffer or Union functions
  can return garbage.