Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-34141: Implements the function ST_Simplify #3376

Conversation

StefanoPetrilli
Copy link

@StefanoPetrilli StefanoPetrilli commented Jun 30, 2024

  • *The Jira issue number for this PR is: MDEV-34141

Description

MariaDB GIS functionalities are limited when compared to other DBMs. To facilitate the migration from MySQL to MariaDB the GIS functionality should be the same. This PR implements the GIS function ST_Simplify(Geometry g, double max_distance). It applies the Ramer–Douglas–Peucker algorithm on g and returns the resulting geometry.
The goal of the Douglas-Peucker algorithm is to find a geometry that is similar to g but uses only a subset of points. The algorithm may produce self-intersections and therefore result in invalid geometries.

If the max_distance is not positive or is NULL, an ER_WRONG_ARGUMENT will occur. The same function is also accessible using simplify(Geometry g1, double max_distance).

To ensure compatibility between the MySQL implementation of this function and the MariaDB implementation, the tests for this function have been cherry-picked from MySQL.

This patch has no side effects.

Release Notes

Adds the function:
ST_Simplify(Geometry g, double max_distance), Simplify(Geometry g, double max_distance) : returns the simplified version of g using the Ramer–Douglas–Peucker algorithms.

How can this PR be tested?

An extensive test suite has been cherry-picked from MySQL.

Basing the PR against the correct MariaDB version

  • This is a new feature or a refactoring, and the PR is based against the latest MariaDB development branch.
  • This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

@grooverdan
Copy link
Member

Note, new error messages go at the end as they are numbered in order of the file. This seems to be the cause of most MTR test failures.

@StefanoPetrilli StefanoPetrilli force-pushed the 11.6-MDEV-34141 branch 5 times, most recently from 6f6d637 to 5b4be6b Compare July 2, 2024 13:45
@StefanoPetrilli StefanoPetrilli changed the base branch from 11.6 to bb-11.7-mdev-34120-gis-functions July 15, 2024 10:33
Copy link
Contributor

@holyfoot holyfoot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok to push.

The GIS function ST_Simplify takes ad input a geometry and a double. It
applies the Ramer-Douglas-Peucker algorithm on the geometry and returns
the resulting geometry. The tests have been cherry-picked from the MySQL
implementation of this function to grant compatibility among the two
implementations.

Co-authored-by: David Zhao <david.zhao@oracle.com>
Co-authored-by: Pavan Naik <pavan.naik@oracle.com>
Co-authored-by: Norvald H. Ryeng <norvald.ryeng@oracle.com>
Co-authored-by: Erlend Dahl <erlend.dahl@oracle.com>
Co-authored-by: Jon Hauglid <jon.hauglid@oracle.com>
Co-authored-by: Hans H Melby <hans.h.melby@oracle.com>
Co-authored-by: Tor Didriksen <tor.didriksen@oracle.com>
@DaveGosselin-MariaDB DaveGosselin-MariaDB merged commit 8c51e63 into MariaDB:bb-11.7-mdev-34120-gis-functions Aug 21, 2024
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants