server
server copied to clipboard
MDEV-34141: Implements the function ST_Simplify
- [x] *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
- [X] 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
- [x] I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
- [x] For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.
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.