[MDEV-12915] ST_Centroid does not return the same result than MySQL Created: 2017-05-25  Updated: 2017-08-01  Resolved: 2017-07-25

Status: Closed
Project: MariaDB Server
Component/s: GIS
Affects Version/s: 10.1.14, 5.5, 10.0, 10.1, 10.2
Fix Version/s: 10.0.31

Type: Bug Priority: Major
Reporter: Paul David-Sivelle Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: upstream-fixed
Environment:

CentOS 6.8


Attachments: PNG File mdev12915.png     PNG File st_centroid_mariadb.png    

 Description   

Hi,

The result of the ST_Centroid method does not seems correct.

For the same request:

SELECT AsText(ST_Centroid(ST_GeomFromText(' POLYGON((-122.8684759 49.2713048,-122.8804596 49.2712636,-122.880427 49.270522,-122.8932944 49.2704508,-122.893126 49.266063,-122.893084 49.2588789,-122.8927188 49.2458679,-122.892531 49.23803,-122.890696 49.236328,-122.8894146 49.2357782,-122.888219 49.236069,-122.886576 49.235914,-122.885352 49.235414,-122.8825066 49.2348937,-122.881285 49.234713,-122.8800524 49.2336459,-122.87881 49.23341,-122.877351 49.232865,-122.8763438 49.2318128,-122.875165 49.231153,-122.8750964 49.2305225,-122.876444 49.229864,-122.876627 49.2289017,-122.8764138 49.2282525,-122.8763938 49.2251511,-122.8755999 49.2253018,-122.8731537 49.2253684,-122.8727568 49.2453868,-122.8727889 49.245848,-122.8694309 49.2487784,-122.8690339 49.2493276,-122.868712 49.263537,-122.8684759 49.2713048)) ')))

I get the following results:

  • On MySQL v5.7.14: POINT(-122.88103164136591 49.25294096399097)
  • On MariaDB v10.1.14: POINT(-122.88026060000001 49.24220679375)

The MySQL result seems to be the good one.

You can find attached a screenshot of the concrete case, as displayed in my application.

Sorry if the bug has been already opened, I didn't found any issue about this subject.



 Comments   
Comment by Elena Stepanova [ 2017-06-02 ]

Thanks for the report.

Also attached visualization done by QGIS/QuickWKT (mdev12915.png). Blue dot is MySQL 5.7, red dot is MariaDB.

Reproducible on MariaDB 5.5 - 10.2, and on MySQL 5.6. Apparently it was fixed in MySQL 5.7.

Comment by Alexey Botchkov [ 2017-07-25 ]

http://lists.askmonty.org/pipermail/commits/2017-July/011321.html
http://lists.askmonty.org/pipermail/commits/2017-July/011322.html

Comment by Daniel Black [ 2017-07-25 ]

Alexey Kopytov and I ended up in a discussion (https://github.com/mysql/mysql-server/pull/158) that brought up https://github.com/mysql/mysql-server/commit/0a417e84 which is probably related to this issue.

Generated at Thu Feb 08 08:01:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.